From 176a7a2eb869e14530d12fc6f87d5ec744904565 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 27 Feb 2025 15:41:33 +0100 Subject: [PATCH] Fix link issues with tag in iframe --- www/calendar/inner.js | 8 -------- www/common/common-ui-elements.js | 11 +++++++---- www/common/drive-ui.js | 6 +----- www/common/onlyoffice/inner.js | 5 ++--- www/common/sframe-app-framework.js | 3 --- www/common/sframe-common-codemirror.js | 2 -- www/form/inner.js | 9 --------- 7 files changed, 10 insertions(+), 34 deletions(-) diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 0994dbb6a..bdf42745e 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -670,7 +670,6 @@ define([ tag: 'a', attributes: { 'data-value': '.ics', - 'href': '#' }, content: '.ics' }); @@ -1303,7 +1302,6 @@ ICS ==> create a new event with the same UID and a RECURRENCE-ID field (with a v attributes: { 'class': 'cp-calendar-view', 'data-value': k, - 'href': '#', }, content: Messages['calendar_'+k] // Messages.calendar_day @@ -1564,7 +1562,6 @@ APP.recurrenceRule = { attributes: { 'class': 'cp-calendar-recurrence', 'data-value': '', - 'href': '#', }, content: Messages.calendar_rec_no }]; @@ -1577,7 +1574,6 @@ APP.recurrenceRule = { attributes: { 'class': 'cp-calendar-recurrence', 'data-value': basicStr[rec], - 'href': '#', }, content: Messages._getKey('calendar_rec_' + rec, [ getWeekDays(true)[date.getDay()], @@ -1598,7 +1594,6 @@ APP.recurrenceRule = { attributes: { 'class': 'cp-calendar-recurrence', 'data-value': basicStr.days, - 'href': '#', }, content: Messages['calendar_rec_' + (isWeekend ? 'weekend' : 'weekdays')] }); @@ -1608,7 +1603,6 @@ APP.recurrenceRule = { attributes: { 'class': 'cp-calendar-recurrence', 'data-value': 'custom', - 'href': '#', }, content: Messages.calendar_rec_custom }); @@ -1690,7 +1684,6 @@ APP.recurrenceRule = { attributes: { 'class': 'cp-calendar-recurrence-freq', 'data-value': rec, - 'href': '#', }, content: Messages['calendar_rec_freq_' + rec] }); @@ -2000,7 +1993,6 @@ APP.recurrenceRule = { attributes: { 'class': 'cp-calendar-reminder', 'data-value': k, - 'href': '#', }, content: Messages['calendar_'+k] // Messages.calendar_minutes diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 378ccdb98..db25ae20f 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1517,6 +1517,9 @@ define([ }); Util.onClickEnter(entry, function(e) { + if ($(e.target).attr('href') === '#') { + e.preventDefault(); + } if (config.isSelect) { return; } e.stopPropagation(); if (typeof(config.action) === "function") { @@ -2406,7 +2409,6 @@ define([ attributes: { 'class': 'cp-language-value', 'data-value': l, - 'href': '#', }, content: [ // supplying content as an array ensures it's a text node, not parsed HTML languages[l] // Pretty name of the language value @@ -3547,14 +3549,15 @@ define([ var text = Messages._getKey('owner_add', [name, title]); + var obj = { pw: msg.content.password || '', f: 1 }; + let newHref = Hash.getNewPadURL(msg.content.href, obj); var link = h('a', { - href: '#' + href: newHref }, Messages.requestEdit_viewPad); $(link).click(function (e) { e.preventDefault(); e.stopPropagation(); - var obj = { pw: msg.content.password || '', f: 1 }; - common.openURL(Hash.getNewPadURL(msg.content.href, obj)); + common.openURL(newHref); }); var div = h('div', [ diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index d7577c78b..2eeb35d7e 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -3137,7 +3137,7 @@ define([ var newObj = { tag: 'a', - attributes: { 'class': obj.class, href: '#' }, + attributes: { 'class': obj.class }, content: [obj.icon, obj.name] }; @@ -3179,7 +3179,6 @@ define([ tag: 'a', attributes: { 'class': 'cp-app-drive-rm-filter', - 'href': '#' }, content: [ h('i.fa.fa-times'), @@ -3192,7 +3191,6 @@ define([ var attributes = { 'class': 'cp-app-drive-filter-doc', 'data-type': type, - 'href': '#' }; var premium = common.checkRestrictedApp(type); @@ -3218,7 +3216,6 @@ define([ attributes: { 'class': 'cp-app-drive-filter-doc', 'data-type': 'link', - 'href': '#' }, content: [ getIcon('link')[0], @@ -3230,7 +3227,6 @@ define([ attributes: { 'class': 'cp-app-drive-filter-doc', 'data-type': 'file', - 'href': '#' }, content: [ getIcon('file')[0], diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 07c2ad1e3..3aeed02b4 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -2211,7 +2211,6 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null tag: 'a', attributes: { 'data-value': val, - href: '#' }, content: val }; @@ -2630,7 +2629,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null (content.version <= 3 ? 'v2b/' : CURRENT_VERSION+'/'); var s = h('script', { type:'text/javascript', - src: '/common/onlyoffice/dist/'+version+'web-apps/apps/api/documents/api.js' + src: ApiConfig.httpSafeOrigin + '/common/onlyoffice/dist/'+version+'web-apps/apps/api/documents/api.js' }); $('#cp-app-oo-editor').empty().append(h('div#cp-app-oo-placeholder-a')).append(s); @@ -3072,7 +3071,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null var s = h('script', { type:'text/javascript', - src: '/common/onlyoffice/dist/'+version+'web-apps/apps/api/documents/api.js' + src: ApiConfig.httpSafeOrigin + '/common/onlyoffice/dist/'+version+'web-apps/apps/api/documents/api.js' }); $('#cp-app-oo-editor').append(s); diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 3f886725c..1bcb85a39 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -721,7 +721,6 @@ define([ tag: 'a', attributes: { 'data-value': _ext, - 'href': '#' }, content: _ext }); @@ -732,7 +731,6 @@ define([ tag: 'a', attributes: { 'data-value': ext, - 'href': '#' }, content: ext }); @@ -741,7 +739,6 @@ define([ tag: 'a', attributes: { 'data-value': '', - 'href': '#' }, content: ' ', }); diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index aa1bde788..e3411dc0e 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -365,7 +365,6 @@ define([ tag: 'a', attributes: { 'data-value': l.mode, - 'href': '#', }, content: [l.language] // Pretty name of the language value }); @@ -431,7 +430,6 @@ define([ tag: 'a', attributes: { 'data-value': l.name, - 'href': '#', }, content: [l.name] // Pretty name of the language value }); diff --git a/www/form/inner.js b/www/form/inner.js index 661b0ee98..9ec256308 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -159,7 +159,6 @@ define([ attributes: { 'class': 'cp-form-type-value', 'data-value': t, - 'href': '#', }, content: Messages['form_text_'+t] }; @@ -262,7 +261,6 @@ define([ attributes: { 'class': 'cp-form-type-value', 'data-value': t, - 'href': '#', }, content: Messages['form_poll_'+t] }; @@ -1295,7 +1293,6 @@ define([ attributes: { 'class': 'cp-form-condition-question', 'data-value': obj.uid, - 'href': '#', }, content: obj.q }; @@ -1316,14 +1313,12 @@ define([ tag: 'a', attributes: { 'data-value': 1, - 'href': '#', }, content: Messages.form_condition_is }, { tag: 'a', attributes: { 'data-value': 0, - 'href': '#', }, content: Messages.form_condition_isnot }]; @@ -1402,7 +1397,6 @@ define([ attributes: { 'class': 'cp-form-condition-value', 'data-value': str, - 'href': '#', }, content: str }; @@ -1576,7 +1570,6 @@ define([ attributes: { 'class': 'cp-form-condition-question', 'data-value': obj.uid, - 'href': '#', }, content: obj.q }; @@ -1604,7 +1597,6 @@ define([ attributes: { 'class': 'cp-form-condition-value', 'data-value': str, - 'href': '#', }, content: str }; @@ -2988,7 +2980,6 @@ define([ attributes: { 'class': 'cp-form-type-value', 'data-value': t.key, - 'href': '#', }, content: t.str };