diff --git a/client/dist/js/TinyMCE_sslink-file.js b/client/dist/js/TinyMCE_sslink-file.js
index 404f79d3f..f8654385a 100644
--- a/client/dist/js/TinyMCE_sslink-file.js
+++ b/client/dist/js/TinyMCE_sslink-file.js
@@ -1 +1 @@
-!function(e){function o(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,o),s.l=!0,s.exports}var t={};o.m=e,o.c=t,o.i=function(e){return e},o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},o.p="",o(o.s="./client/src/entwine/TinyMCE_sslink-file.js")}({"./client/src/entwine/TinyMCE_sslink-file.js":function(e,o,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(o,"__esModule",{value:!0});var s=t(2),r=n(s),a=t(30),d=n(a),l=t(0),i=n(l),u=t(6),_=n(u),c=t(7),h=n(c),f=t(10),p=n(f),m=t(12),j=n(m),v=t(3),y=n(v),g=t("./client/src/state/modal/ModalActions.js"),b=function(e){if(e&&e.__esModule)return e;var o={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(o[t]=e[t]);return o.default=e,o}(g);d.default.addAction("sslink",{text:r.default._t("AssetAdmin.LINKLABEL_FILE","Link to a file"),onclick:function(e){return e.execCommand("sslinkfile")},priority:80},editorIdentifier).addCommandWithUrlTest("sslinkfile",/^\[file_link/);var x={init:function(e){e.addCommand("sslinkfile",function(){(0,h.default)("#"+e.id).entwine("ss").openLinkFileDialog()})}},S="insert-link__dialog-wrapper--file",C=(0,v.loadComponent)(j.default);h.default.entwine("ss",function(e){e("textarea.htmleditor").entwine({openLinkFileDialog:function(){var o=e("#"+S);o.length||(o=e('
'),e("body").append(o)),o.addClass("insert-link__dialog-wrapper"),o.setElement(this),o.open()}}),e(".js-injector-boot #"+S).entwine({renderModal:function(e){var o=this,t=y.default.reducer.store.dispatch;t(b.initFormStack("insert-link","admin"));var n=function(){t(b.reset()),o.close()},s=function(){return o.handleInsert.apply(o,arguments)},r=this.getOriginalAttributes(),a=this.getFolderId(),d=this.getRequireLinkText();_.default.render(i.default.createElement(C,{isOpen:e,type:"insert-link",folderId:a,onInsert:s,onClosed:n,title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:r,requireLinkText:d}),this[0])},buildAttributes:function(e){return{href:p.default.serialise({name:"file_link",properties:{id:e.ID}},!0)+(e.Anchor&&e.Anchor.length?"#"+e.Anchor:""),target:e.TargetBlank?"_blank":"",title:e.Description}},getFolderId:function(){var e=this.getElement();if(!e)return null;var o=Number(e.data("config").upload_folder_id);return isNaN(o)?null:o},getOriginalAttributes:function(){var o=this.getElement().getEditor(),t=e(o.getSelectedNode()),n=(t.attr("href")||"").split("#");if(!n[0])return{};var s=p.default.match("file_link",!1,n[0]);return s?{ID:s.properties.id?parseInt(s.properties.id,10):0,Anchor:n[1]||"",Description:t.attr("title"),TargetBlank:!!t.attr("target")}:{}}})}),tinymce.PluginManager.add("sslinkfile",function(e){return x.init(e)}),o.default=x},"./client/src/state/modal/ModalActionTypes.js":function(e,o,t){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default={DEFINE_IMAGE_SIZE_PRESETS:"DEFINE_IMAGE_SIZE_PRESETS",INIT_FORM_SCHEMA_STACK:"INIT_FORM_SCHEMA_STACK",POP_FORM_SCHEMA:"POP_FORM_SCHEMA",PUSH_FORM_SCHEMA:"PUSH_FORM_SCHEMA",RESET:"RESET",RESET_FORM_STACK:"RESET_FORM_STACK"}},"./client/src/state/modal/ModalActions.js":function(e,o,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function s(e){return{type:c.default.DEFINE_IMAGE_SIZE_PRESETS,payload:{imageSizePresets:e}}}function r(e,o){return function(t,n){var s=n(),r=(0,f.default)(s.form.formState,e+".values"),a=(0,f.default)(s.form.formSchemas,o+".schema.fields");if(r){var d=Object.keys(r).filter(function(e){return null!==r[e]&&(0,j.default)(e,a)}).map(function(e){return{name:e,value:r[e]}});t((0,p.setSchemaStateOverrides)(o,{fields:d}))}}}function a(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:c.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:o}}}}function d(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:c.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:o}}}}function l(){return{type:c.default.POP_FORM_SCHEMA}}function i(){return{type:c.default.RESET}}function u(){return{type:c.default.RESET_FORM_STACK}}Object.defineProperty(o,"__esModule",{value:!0}),o.defineImageSizePresets=s,o.stashFormValues=r,o.pushFormStackEntry=a,o.initFormStack=d,o.popFormStackEntry=l,o.reset=i,o.resetFormStack=u;var _=t("./client/src/state/modal/ModalActionTypes.js"),c=n(_),h=t("./node_modules/redux-form/lib/structure/plain/getIn.js"),f=n(h),p=t(8),m=t("./client/src/state/modal/helpers.js"),j=n(m)},"./client/src/state/modal/helpers.js":function(e,o,t){"use strict";function n(e,o){var t=void 0;for(t=0;t-1}var s=t("./node_modules/lodash/_assocIndexOf.js");e.exports=n},"./node_modules/lodash/_listCacheSet.js":function(e,o,t){function n(e,o){var t=this.__data__,n=s(t,e);return n<0?(++this.size,t.push([e,o])):t[n][1]=o,this}var s=t("./node_modules/lodash/_assocIndexOf.js");e.exports=n},"./node_modules/lodash/_mapCacheClear.js":function(e,o,t){function n(){this.size=0,this.__data__={hash:new s,map:new(a||r),string:new s}}var s=t("./node_modules/lodash/_Hash.js"),r=t("./node_modules/lodash/_ListCache.js"),a=t("./node_modules/lodash/_Map.js");e.exports=n},"./node_modules/lodash/_mapCacheDelete.js":function(e,o,t){function n(e){var o=s(this,e).delete(e);return this.size-=o?1:0,o}var s=t("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheGet.js":function(e,o,t){function n(e){return s(this,e).get(e)}var s=t("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheHas.js":function(e,o,t){function n(e){return s(this,e).has(e)}var s=t("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheSet.js":function(e,o,t){function n(e,o){var t=s(this,e),n=t.size;return t.set(e,o),this.size+=t.size==n?0:1,this}var s=t("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_memoizeCapped.js":function(e,o,t){function n(e){var o=s(e,function(e){return t.size===r&&t.clear(),e}),t=o.cache;return o}var s=t("./node_modules/lodash/memoize.js"),r=500;e.exports=n},"./node_modules/lodash/_nativeCreate.js":function(e,o,t){var n=t("./node_modules/lodash/_getNative.js"),s=n(Object,"create");e.exports=s},"./node_modules/lodash/_objectToString.js":function(e,o){function t(e){return s.call(e)}var n=Object.prototype,s=n.toString;e.exports=t},"./node_modules/lodash/_root.js":function(e,o,t){var n=t("./node_modules/lodash/_freeGlobal.js"),s="object"==typeof self&&self&&self.Object===Object&&self,r=n||s||Function("return this")();e.exports=r},"./node_modules/lodash/_stringToPath.js":function(e,o,t){var n=t("./node_modules/lodash/_memoizeCapped.js"),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=n(function(e){var o=[];return 46===e.charCodeAt(0)&&o.push(""),e.replace(s,function(e,t,n,s){o.push(n?s.replace(r,"$1"):t||e)}),o});e.exports=a},"./node_modules/lodash/_toKey.js":function(e,o,t){function n(e){if("string"==typeof e||s(e))return e;var o=e+"";return"0"==o&&1/e==-r?"-0":o}var s=t("./node_modules/lodash/isSymbol.js"),r=1/0;e.exports=n},"./node_modules/lodash/_toSource.js":function(e,o){function t(e){if(null!=e){try{return s.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var n=Function.prototype,s=n.toString;e.exports=t},"./node_modules/lodash/eq.js":function(e,o){function t(e,o){return e===o||e!==e&&o!==o}e.exports=t},"./node_modules/lodash/isArray.js":function(e,o){var t=Array.isArray;e.exports=t},"./node_modules/lodash/isFunction.js":function(e,o,t){function n(e){if(!r(e))return!1;var o=s(e);return o==d||o==l||o==a||o==i}var s=t("./node_modules/lodash/_baseGetTag.js"),r=t("./node_modules/lodash/isObject.js"),a="[object AsyncFunction]",d="[object Function]",l="[object GeneratorFunction]",i="[object Proxy]";e.exports=n},"./node_modules/lodash/isObject.js":function(e,o){function t(e){var o=typeof e;return null!=e&&("object"==o||"function"==o)}e.exports=t},"./node_modules/lodash/isObjectLike.js":function(e,o){function t(e){return null!=e&&"object"==typeof e}e.exports=t},"./node_modules/lodash/isSymbol.js":function(e,o,t){function n(e){return"symbol"==typeof e||r(e)&&s(e)==a}var s=t("./node_modules/lodash/_baseGetTag.js"),r=t("./node_modules/lodash/isObjectLike.js"),a="[object Symbol]";e.exports=n},"./node_modules/lodash/memoize.js":function(e,o,t){function n(e,o){if("function"!=typeof e||null!=o&&"function"!=typeof o)throw new TypeError(r);var t=function(){var n=arguments,s=o?o.apply(this,n):n[0],r=t.cache;if(r.has(s))return r.get(s);var a=e.apply(this,n);return t.cache=r.set(s,a)||r,a};return t.cache=new(n.Cache||s),t}var s=t("./node_modules/lodash/_MapCache.js"),r="Expected a function";n.Cache=s,e.exports=n},"./node_modules/lodash/toPath.js":function(e,o,t){function n(e){return a(e)?s(e,i):d(e)?[e]:r(l(u(e)))}var s=t("./node_modules/lodash/_arrayMap.js"),r=t("./node_modules/lodash/_copyArray.js"),a=t("./node_modules/lodash/isArray.js"),d=t("./node_modules/lodash/isSymbol.js"),l=t("./node_modules/lodash/_stringToPath.js"),i=t("./node_modules/lodash/_toKey.js"),u=t("./node_modules/lodash/toString.js");e.exports=n},"./node_modules/lodash/toString.js":function(e,o,t){function n(e){return null==e?"":s(e)}var s=t("./node_modules/lodash/_baseToString.js");e.exports=n},"./node_modules/redux-form/lib/structure/plain/getIn.js":function(e,o,t){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var n=t("./node_modules/lodash/toPath.js"),s=function(e){return e&&e.__esModule?e:{default:e}}(n),r=function(e,o){if(!e)return e;var t=(0,s.default)(o),n=t.length;if(n){for(var r=e,a=0;a'),e("body").append(o)),o.addClass("insert-link__dialog-wrapper"),o.setElement(this),o.open()}}),e(".js-injector-boot #"+S).entwine({renderModal:function(e){var o=this,t=y.default.reducer.store.dispatch;t(b.initFormStack("insert-link","admin"));var n=function(){t(b.reset()),o.close()},s=function(){return o.handleInsert.apply(o,arguments)},r=this.getOriginalAttributes(),a=this.getFolderId(),d=this.getRequireLinkText();_.default.render(i.default.createElement(C,{isOpen:e,type:"insert-link",folderId:a,onInsert:s,onClosed:n,title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:r,requireLinkText:d}),this[0])},buildAttributes:function(e){return{href:p.default.serialise({name:"file_link",properties:{id:e.ID}},!0)+(e.Anchor&&e.Anchor.length?"#"+e.Anchor:""),target:e.TargetBlank?"_blank":"",title:e.Description}},getFolderId:function(){var e=this.getElement();if(!e)return null;var o=Number(e.data("config").upload_folder_id);return isNaN(o)?null:o},getOriginalAttributes:function(){var o=this.getElement().getEditor(),t=e(o.getSelectedNode()),n=(t.attr("href")||"").split("#");if(!n[0])return{};var s=p.default.match("file_link",!1,n[0]);return s?{ID:s.properties.id?parseInt(s.properties.id,10):0,Anchor:n[1]||"",Description:t.attr("title"),TargetBlank:!!t.attr("target")}:{}}})}),tinymce.PluginManager.add("sslinkfile",function(e){return x.init(e)}),o.default=x},"./client/src/state/modal/ModalActionTypes.js":function(e,o,t){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default={DEFINE_IMAGE_SIZE_PRESETS:"DEFINE_IMAGE_SIZE_PRESETS",INIT_FORM_SCHEMA_STACK:"INIT_FORM_SCHEMA_STACK",POP_FORM_SCHEMA:"POP_FORM_SCHEMA",PUSH_FORM_SCHEMA:"PUSH_FORM_SCHEMA",RESET:"RESET",RESET_FORM_STACK:"RESET_FORM_STACK"}},"./client/src/state/modal/ModalActions.js":function(e,o,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function s(e){return{type:c.default.DEFINE_IMAGE_SIZE_PRESETS,payload:{imageSizePresets:e}}}function r(e,o){return function(t,n){var s=n(),r=(0,f.default)(s.form.formState,e+".values"),a=(0,f.default)(s.form.formSchemas,o+".schema.fields");if(r){var d=Object.keys(r).filter(function(e){return null!==r[e]&&(0,j.default)(e,a)}).map(function(e){return{name:e,value:r[e]}});t((0,p.setSchemaStateOverrides)(o,{fields:d}))}}}function a(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:c.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:o}}}}function d(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:c.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:o}}}}function l(){return{type:c.default.POP_FORM_SCHEMA}}function i(){return{type:c.default.RESET}}function u(){return{type:c.default.RESET_FORM_STACK}}Object.defineProperty(o,"__esModule",{value:!0}),o.defineImageSizePresets=s,o.stashFormValues=r,o.pushFormStackEntry=a,o.initFormStack=d,o.popFormStackEntry=l,o.reset=i,o.resetFormStack=u;var _=t("./client/src/state/modal/ModalActionTypes.js"),c=n(_),h=t("./node_modules/redux-form/lib/structure/plain/getIn.js"),f=n(h),p=t(8),m=t("./client/src/state/modal/helpers.js"),j=n(m)},"./client/src/state/modal/helpers.js":function(e,o,t){"use strict";function n(e,o){var t=void 0;for(t=0;t-1}var s=t("./node_modules/lodash/_assocIndexOf.js");e.exports=n},"./node_modules/lodash/_listCacheSet.js":function(e,o,t){function n(e,o){var t=this.__data__,n=s(t,e);return n<0?(++this.size,t.push([e,o])):t[n][1]=o,this}var s=t("./node_modules/lodash/_assocIndexOf.js");e.exports=n},"./node_modules/lodash/_mapCacheClear.js":function(e,o,t){function n(){this.size=0,this.__data__={hash:new s,map:new(a||r),string:new s}}var s=t("./node_modules/lodash/_Hash.js"),r=t("./node_modules/lodash/_ListCache.js"),a=t("./node_modules/lodash/_Map.js");e.exports=n},"./node_modules/lodash/_mapCacheDelete.js":function(e,o,t){function n(e){var o=s(this,e).delete(e);return this.size-=o?1:0,o}var s=t("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheGet.js":function(e,o,t){function n(e){return s(this,e).get(e)}var s=t("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheHas.js":function(e,o,t){function n(e){return s(this,e).has(e)}var s=t("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheSet.js":function(e,o,t){function n(e,o){var t=s(this,e),n=t.size;return t.set(e,o),this.size+=t.size==n?0:1,this}var s=t("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_memoizeCapped.js":function(e,o,t){function n(e){var o=s(e,function(e){return t.size===r&&t.clear(),e}),t=o.cache;return o}var s=t("./node_modules/lodash/memoize.js"),r=500;e.exports=n},"./node_modules/lodash/_nativeCreate.js":function(e,o,t){var n=t("./node_modules/lodash/_getNative.js"),s=n(Object,"create");e.exports=s},"./node_modules/lodash/_objectToString.js":function(e,o){function t(e){return s.call(e)}var n=Object.prototype,s=n.toString;e.exports=t},"./node_modules/lodash/_root.js":function(e,o,t){var n=t("./node_modules/lodash/_freeGlobal.js"),s="object"==typeof self&&self&&self.Object===Object&&self,r=n||s||Function("return this")();e.exports=r},"./node_modules/lodash/_stringToPath.js":function(e,o,t){var n=t("./node_modules/lodash/_memoizeCapped.js"),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=n(function(e){var o=[];return 46===e.charCodeAt(0)&&o.push(""),e.replace(s,function(e,t,n,s){o.push(n?s.replace(r,"$1"):t||e)}),o});e.exports=a},"./node_modules/lodash/_toKey.js":function(e,o,t){function n(e){if("string"==typeof e||s(e))return e;var o=e+"";return"0"==o&&1/e==-r?"-0":o}var s=t("./node_modules/lodash/isSymbol.js"),r=1/0;e.exports=n},"./node_modules/lodash/_toSource.js":function(e,o){function t(e){if(null!=e){try{return s.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var n=Function.prototype,s=n.toString;e.exports=t},"./node_modules/lodash/eq.js":function(e,o){function t(e,o){return e===o||e!==e&&o!==o}e.exports=t},"./node_modules/lodash/isArray.js":function(e,o){var t=Array.isArray;e.exports=t},"./node_modules/lodash/isFunction.js":function(e,o,t){function n(e){if(!r(e))return!1;var o=s(e);return o==d||o==l||o==a||o==i}var s=t("./node_modules/lodash/_baseGetTag.js"),r=t("./node_modules/lodash/isObject.js"),a="[object AsyncFunction]",d="[object Function]",l="[object GeneratorFunction]",i="[object Proxy]";e.exports=n},"./node_modules/lodash/isObject.js":function(e,o){function t(e){var o=typeof e;return null!=e&&("object"==o||"function"==o)}e.exports=t},"./node_modules/lodash/isObjectLike.js":function(e,o){function t(e){return null!=e&&"object"==typeof e}e.exports=t},"./node_modules/lodash/isSymbol.js":function(e,o,t){function n(e){return"symbol"==typeof e||r(e)&&s(e)==a}var s=t("./node_modules/lodash/_baseGetTag.js"),r=t("./node_modules/lodash/isObjectLike.js"),a="[object Symbol]";e.exports=n},"./node_modules/lodash/memoize.js":function(e,o,t){function n(e,o){if("function"!=typeof e||null!=o&&"function"!=typeof o)throw new TypeError(r);var t=function(){var n=arguments,s=o?o.apply(this,n):n[0],r=t.cache;if(r.has(s))return r.get(s);var a=e.apply(this,n);return t.cache=r.set(s,a)||r,a};return t.cache=new(n.Cache||s),t}var s=t("./node_modules/lodash/_MapCache.js"),r="Expected a function";n.Cache=s,e.exports=n},"./node_modules/lodash/toPath.js":function(e,o,t){function n(e){return a(e)?s(e,i):d(e)?[e]:r(l(u(e)))}var s=t("./node_modules/lodash/_arrayMap.js"),r=t("./node_modules/lodash/_copyArray.js"),a=t("./node_modules/lodash/isArray.js"),d=t("./node_modules/lodash/isSymbol.js"),l=t("./node_modules/lodash/_stringToPath.js"),i=t("./node_modules/lodash/_toKey.js"),u=t("./node_modules/lodash/toString.js");e.exports=n},"./node_modules/lodash/toString.js":function(e,o,t){function n(e){return null==e?"":s(e)}var s=t("./node_modules/lodash/_baseToString.js");e.exports=n},"./node_modules/redux-form/lib/structure/plain/getIn.js":function(e,o,t){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var n=t("./node_modules/lodash/toPath.js"),s=function(e){return e&&e.__esModule?e:{default:e}}(n),r=function(e,o){if(!e)return e;var t=(0,s.default)(o),n=t.length;if(n){for(var r=e,a=0;a activeEditor.execCommand(commandName),
- priority: 80
- },
- editorIdentifier,
-).addCommandWithUrlTest(commandName, /^\[file_link/);
-
const plugin = {
init(editor) {
+ // Add "Link to external url" to link menu for this editor
+ TinyMCEActionRegistrar.addAction(
+ 'sslink',
+ {
+ text: i18n._t('AssetAdmin.LINKLABEL_FILE', 'Link to a file'),
+ // eslint-disable-next-line no-console
+ onclick: (activeEditor) => activeEditor.execCommand(commandName),
+ priority: 80
+ },
+ editor.settings.editorIdentifier,
+ ).addCommandWithUrlTest(commandName, /^\[file_link/);
+
+ // Add a command that corresponds with the above menu item
editor.addCommand(commandName, () => {
const field = jQuery(`#${editor.id}`).entwine('ss');
diff --git a/composer.json b/composer.json
index d3ab700ab..2c5d29889 100644
--- a/composer.json
+++ b/composer.json
@@ -13,6 +13,7 @@
"phpunit/phpunit": "^9.5",
"silverstripe/frameworktest": "^0.4.3",
"squizlabs/php_codesniffer": "^3",
+ "silverstripe/admin": "^1.13.99",
"silverstripe/cms": "^4.5",
"silverstripe/campaign-admin": "^1.5"
},