diff --git a/client/dist/js/TinyMCE_sslink.js b/client/dist/js/TinyMCE_sslink.js index c01182e4e..8ac561e86 100644 --- a/client/dist/js/TinyMCE_sslink.js +++ b/client/dist/js/TinyMCE_sslink.js @@ -1 +1 @@ -!function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s="./client/src/legacy/TinyMCE_sslink.js")}({"./client/src/components/TinymceInlineToolbar/TinymceInlineToolbar.js":function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){var o=Array.isArray(n)?n:[n||""];return!(!t||!e)&&(o=o.map(function(t){return String(t)}).map(function(t){return t.toLowerCase()}),o.filter(function(e){if(e.indexOf("[")>-1&&e.indexOf("]")>-1){var n=e.substring(0,e.indexOf("[")),o=e.substring(e.indexOf("[")+1,e.indexOf("]"));if(n===t.tagName.toLowerCase()&&t.getAttribute(o))return!0}else if(t.tagName&&e===t.tagName.toLowerCase())return!0;return!1}).length>0)}function r(t,e){function n(){i(l,s,o)&&(r.hide(),clearTimeout(c),c=setTimeout(function(){r.show(),r.reposition(l)},300))}var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["a"],r=new a(t,e),l=null,c=null,s=!1;return r.hide().renderTo(window.document.body),t.on("remove",function(){r.remove()}),t.on("focus",function(){s=!0}),t.on("blur hide",function(){r.hide(),s=!1}),t.on("nodechange",function(e){var n={element:e.element,parents:e.parents,collapsed:t.selection.isCollapsed()};l=n.selection||n.element,i(l,s,o)?(r.show(),r.reposition(l)):r.hide()}),window.addEventListener("scroll",function(e){e.target.contains(document.querySelector("#"+t.id))&&n()},!0),t.contentDocument.addEventListener("scroll",n),r}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n=k||b>=k?this.hide():(this.bottom?b>=f?(y=" mce-arrow-up",v=s.bottom+r.top+n+10):g>=f&&(y=" mce-arrow-down",v=s.top+r.top+n-c-8):g>=f?(y=" mce-arrow-down",v=s.top+r.top+n-c-8):b>=f&&k/2>s.bottom+r.top-h&&(y=" mce-arrow-up",v=s.bottom+r.top+n+10),0===v&&(v=n+h+5),w=u-a/2+r.left+e,s.left<0||s.right>r.width?w=r.left+e+(r.width-a)/2:a>=o?(y+=" mce-arrow-full",w=0):w<0&&s.left+a>o||w+a>o&&s.right-a<0?w=(o-a)/2:wr.width+r.left+e&&(y+=" mce-arrow-right",w=s.right-a+r.left+e),l.className=l.className.replace(/ ?mce-arrow-[\w]+/g,"")+y,this.setStyles({left:w,top:v}),this)}}]),t}();e.default=a,e.setupTinyMceInlineToolbar=r,e.shouldShowToolbar=i},"./client/src/legacy/TinyMCE_sslink.js":function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=o(i),l=n(0),a=o(l),c=n(3),s=o(c),u=n("./client/src/components/TinymceInlineToolbar/TinymceInlineToolbar.js"),f=n(7),d=n(2),m=o(d),h={init:function(t){function e(){var e=tinymce.activeEditor.selection.getNode(),n=e.getAttribute("href");n&&t.execCommand(r.default.getEditorCommandFromUrl(n))}var n=this,o=navigator.platform.toUpperCase().includes("MAC")?"⌘":"Ctrl",i=m.default._t("Admin.INSERT_LINK","Insert link"),l=m.default.inject(m.default._t("Admin.INSERT_LINK_WITH_SHORTCUT","Insert link {shortcut}"),{shortcut:"["+o+"+K]"}),a=r.default.getSortedActions("sslink",t.settings.editorIdentifier,!0).map(function(e){return Object.assign({},e,{onclick:function(){return e.onclick(t)}})});t.addButton("sslink",{icon:"link",title:l,type:"menubutton",menu:a}),t.addMenuItem("sslink",{icon:"link",text:i,menu:a}),t.addShortcut("Meta+k","Open link menu",function(){(0,s.default)('[aria-label^="'+i+'"] > button',t.container).first().click()}),t.on("preinit",function(){(0,u.setupTinyMceInlineToolbar)(t,[{type:"button",onClick:e,text:"Edit link"},{type:"button",onClick:function(){return n.handleRemoveLinkClick(t)},text:"Remove link"}],["a[href]"])})},handleRemoveLinkClick:function(t){var e=t.execCommand("unlink"),n=t.selection.getNode();return n&&void 0!==n.normalize&&n.normalize(),e}};s.default.entwine("ss",function(t){t(".insert-link__dialog-wrapper").entwine({Element:null,Data:{},Bookmark:null,onunmatch:function(){this._clearModal()},_clearModal:function(){a.default.unmountComponentAtNode(this[0])},open:function(){var t=this.getElement().getEditor().getInstance();this.setBookmark(t.selection.getBookmark(2,!0)),this.renderModal(!0)},close:function(){this.setData({}),this.renderModal(!1)},renderModal:function(){},handleInsert:function(t){this.getElement().getEditor().getInstance().selection.moveToBookmark(this.getBookmark());var e=this.buildAttributes(t),n=(0,f.createHTMLSanitiser)(),o=n(t.Text);return this.insertLinkInEditor(e,o),this.close(),Promise.resolve()},buildAttributes:function(t){var e=t.Anchor,n=t.Link,o=t.TargetBlank,i=t.Description,r=e&&e.length?"#"+e:"";return r=r.replace(/^#+/,"#"),{href:""+n+r,target:o?"_blank":"",title:i}},insertLinkInEditor:function(t,e){var n=this.getElement().getEditor();n.insertLink(t,null,e),n.addUndo(),n.repaint();var o=n.getInstance(),i=o.selection;setTimeout(function(){return i&&i.collapse()},0)},getOriginalAttributes:function(){var e=this.getElement().getEditor(),n=t(e.getSelectedNode()),o=(n.attr("href")||"").split("#");return{Link:o[0]||"",Anchor:o[1]||"",Description:n.attr("title"),TargetBlank:!!n.attr("target")}}})}),tinymce.PluginManager.add("sslink",function(t){return h.init(t)}),e.default=h},0:function(t,e){t.exports=ReactDom},1:function(t,e){t.exports=TinyMCEActionRegistrar},2:function(t,e){t.exports=i18n},3:function(t,e){t.exports=jQuery},7:function(t,e){t.exports=ShortcodeSerialiser}}); \ No newline at end of file +!function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s="./client/src/legacy/TinyMCE_sslink.js")}({"./client/src/components/TinymceInlineToolbar/TinymceInlineToolbar.js":function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){var o=Array.isArray(n)?n:[n||""];return!(!t||!e)&&(o=o.map(function(t){return String(t)}).map(function(t){return t.toLowerCase()}),o.filter(function(e){if(e.indexOf("[")>-1&&e.indexOf("]")>-1){var n=e.substring(0,e.indexOf("[")),o=e.substring(e.indexOf("[")+1,e.indexOf("]"));if(n===t.tagName.toLowerCase()&&t.getAttribute(o))return!0}else if(t.tagName&&e===t.tagName.toLowerCase())return!0;return!1}).length>0)}function r(t,e){function n(){i(l,s,o)&&(r.hide(),clearTimeout(c),c=setTimeout(function(){r.show(),r.reposition(l)},300))}var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["a"],r=new a(t,e),l=null,c=null,s=!1;return r.hide().renderTo(window.document.body),t.on("remove",function(){r.remove()}),t.on("focus",function(){s=!0}),t.on("blur hide",function(){r.hide(),s=!1}),t.on("nodechange",function(e){var n={element:e.element,parents:e.parents,collapsed:t.selection.isCollapsed()};l=n.selection||n.element,i(l,s,o)?(r.show(),r.reposition(l)):r.hide()}),window.addEventListener("scroll",function(e){e.target.contains(document.querySelector("#"+t.id))&&n()},!0),t.contentDocument.addEventListener("scroll",n),r}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n=k||b>=k?this.hide():(this.bottom?b>=d?(y=" mce-arrow-up",v=s.bottom+r.top+n+10):g>=d&&(y=" mce-arrow-down",v=s.top+r.top+n-c-8):g>=d?(y=" mce-arrow-down",v=s.top+r.top+n-c-8):b>=d&&k/2>s.bottom+r.top-h&&(y=" mce-arrow-up",v=s.bottom+r.top+n+10),0===v&&(v=n+h+5),w=u-a/2+r.left+e,s.left<0||s.right>r.width?w=r.left+e+(r.width-a)/2:a>=o?(y+=" mce-arrow-full",w=0):w<0&&s.left+a>o||w+a>o&&s.right-a<0?w=(o-a)/2:wr.width+r.left+e&&(y+=" mce-arrow-right",w=s.right-a+r.left+e),l.className=l.className.replace(/ ?mce-arrow-[\w]+/g,"")+y,this.setStyles({left:w,top:v}),this)}}]),t}();e.default=a,e.setupTinyMceInlineToolbar=r,e.shouldShowToolbar=i},"./client/src/legacy/TinyMCE_sslink.js":function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=o(i),l=n(0),a=o(l),c=n(3),s=o(c),u=n("./client/src/components/TinymceInlineToolbar/TinymceInlineToolbar.js"),d=n(7),f=n(2),m=o(f),h={init:function(t){function e(){var e=tinymce.activeEditor.selection.getNode(),n=e.getAttribute("href");n&&t.execCommand(r.default.getEditorCommandFromUrl(n))}var n=this,o=navigator.platform.toUpperCase().includes("MAC")?"⌘":"Ctrl",i=m.default._t("Admin.INSERT_LINK","Insert link"),l=m.default.inject(m.default._t("Admin.INSERT_LINK_WITH_SHORTCUT","Insert link {shortcut}"),{shortcut:"["+o+"+K]"}),a=r.default.getSortedActions("sslink",t.settings.editorIdentifier,!0).map(function(e){return Object.assign({},e,{onclick:function(){return e.onclick(t)}})});t.addButton("sslink",{icon:"link",title:l,type:"menubutton",menu:a}),t.addMenuItem("sslink",{icon:"link",text:i,menu:a}),t.addShortcut("Meta+k","Open link menu",function(){(0,s.default)('[aria-label^="'+i+'"] > button',t.container).first().click()}),t.on("preinit",function(){(0,u.setupTinyMceInlineToolbar)(t,[{type:"button",onClick:e,text:m.default._t("Admin.EDIT_LINK","Edit link")},{type:"button",onClick:function(){return n.handleRemoveLinkClick(t)},text:m.default._t("Admin.REMOVE_LINK","Remove link")}],["a[href]"])})},handleRemoveLinkClick:function(t){var e=t.execCommand("unlink"),n=t.selection.getNode();return n&&void 0!==n.normalize&&n.normalize(),e}};s.default.entwine("ss",function(t){t(".insert-link__dialog-wrapper").entwine({Element:null,Data:{},Bookmark:null,onunmatch:function(){this._clearModal()},_clearModal:function(){a.default.unmountComponentAtNode(this[0])},open:function(){var t=this.getElement().getEditor().getInstance();this.setBookmark(t.selection.getBookmark(2,!0)),this.renderModal(!0)},close:function(){this.setData({}),this.renderModal(!1)},renderModal:function(){},handleInsert:function(t){this.getElement().getEditor().getInstance().selection.moveToBookmark(this.getBookmark());var e=this.buildAttributes(t),n=(0,d.createHTMLSanitiser)(),o=n(t.Text);return this.insertLinkInEditor(e,o),this.close(),Promise.resolve()},buildAttributes:function(t){var e=t.Anchor,n=t.Link,o=t.TargetBlank,i=t.Description,r=e&&e.length?"#"+e:"";return r=r.replace(/^#+/,"#"),{href:""+n+r,target:o?"_blank":"",title:i}},insertLinkInEditor:function(t,e){var n=this.getElement().getEditor();n.insertLink(t,null,e),n.addUndo(),n.repaint();var o=n.getInstance(),i=o.selection;setTimeout(function(){return i&&i.collapse()},0)},getOriginalAttributes:function(){var e=this.getElement().getEditor(),n=t(e.getSelectedNode()),o=(n.attr("href")||"").split("#");return{Link:o[0]||"",Anchor:o[1]||"",Description:n.attr("title"),TargetBlank:!!n.attr("target")}}})}),tinymce.PluginManager.add("sslink",function(t){return h.init(t)}),e.default=h},0:function(t,e){t.exports=ReactDom},1:function(t,e){t.exports=TinyMCEActionRegistrar},2:function(t,e){t.exports=i18n},3:function(t,e){t.exports=jQuery},7:function(t,e){t.exports=ShortcodeSerialiser}}); \ No newline at end of file diff --git a/client/lang/src/en.json b/client/lang/src/en.json index e14d593fe..40730f80b 100644 --- a/client/lang/src/en.json +++ b/client/lang/src/en.json @@ -17,6 +17,8 @@ "Admin.VALIDATION_ERRORS_IN_TAB_SCREEN_READER": "(Has validation errors)", "Admin.NONE": "None", "Admin.EDIT": "Edit", + "Admin.EDIT_LINK": "Edit link", + "Admin.REMOVE_LINK": "Remove link", "Admin.ANY": "Any", "Admin.ERRORINTRANSACTION": "An error occured while fetching data from the server\n Please try again later.", "Admin.DELETECONFIRMMESSAGE": "Are you sure you want to delete this record?", diff --git a/client/src/legacy/TinyMCE_sslink.js b/client/src/legacy/TinyMCE_sslink.js index 52c35293d..01601b46c 100644 --- a/client/src/legacy/TinyMCE_sslink.js +++ b/client/src/legacy/TinyMCE_sslink.js @@ -54,8 +54,8 @@ const plugin = { editor.on('preinit', () => { setupTinyMceInlineToolbar(editor, [ - { type: 'button', onClick: openLinkDialog, text: 'Edit link' }, - { type: 'button', onClick: () => this.handleRemoveLinkClick(editor), text: 'Remove link' }, + { type: 'button', onClick: openLinkDialog, text: i18n._t('Admin.EDIT_LINK', 'Edit link') }, + { type: 'button', onClick: () => this.handleRemoveLinkClick(editor), text: i18n._t('Admin.REMOVE_LINK', 'Remove link') }, ], ['a[href]']); }); },