From 46a25f15c13623db941cca6e6e6a353c580d4a22 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Fri, 30 Sep 2022 18:23:32 +1300 Subject: [PATCH] FIX Use correct selection logic for tinymce --- client/dist/js/TinyMCE_sslink-file.js | 2 +- client/dist/js/TinyMCE_ssmedia.js | 2 +- client/src/entwine/TinyMCE_sslink-file.js | 5 +++-- client/src/entwine/TinyMCE_ssmedia.js | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client/dist/js/TinyMCE_sslink-file.js b/client/dist/js/TinyMCE_sslink-file.js index 4a03df929..7533dce0e 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"),onAction:function(e){return e.execCommand("sslinkfile")},priority:80},editorIdentifier).addCommandWithUrlTest("sslinkfile",/^\[file_link/);var S={init:function(e){e.addCommand("sslinkfile",function(){(0,h.default)("#"+e.id).entwine("ss").openLinkFileDialog()})}},x="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("#"+x);o.length||(o=e('
'),e("body").append(o)),o.addClass("insert-link__dialog-wrapper"),o.setElement(this),o.open()}}),e(".js-injector-boot #"+x).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=tinymce.activeEditor.selection,d=a.getContent()||"",l=a.getNode().tagName,u="A"!==l&&""===d.trim();_.default.render(i.default.createElement(C,{isOpen:e,type:"insert-link",onInsert:s,onClosed:n,title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:r,requireLinkText:u}),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}},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 S.init(e)}),o.default=S},"./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 #"+x).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.getElement().getEditor(),d=a.getInstance().selection,l=a.getSelection(),u=d.getNode().tagName,c="A"!==u&&""===l.trim();_.default.render(i.default.createElement(C,{isOpen:e,type:"insert-link",onInsert:s,onClosed:n,title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:r,requireLinkText:c}),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}},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 S.init(e)}),o.default=S},"./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=0||Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);return o}var a=o(7),r=n(a),i=o(2),d=n(i),l=o(0),u=n(l),c=o(6),_=n(c),h=o(3),f=n(h),m=o(12),p=n(m),v=o(10),g=n(v),j=o("./client/src/entwine/TinyMCE_ssmedia_sizepressets.js"),y=o("./client/src/state/modal/ModalActions.js"),x=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t.default=e,t}(y),b=(0,h.loadComponent)(p.default),S='img[data-shortcode="image"]';!function(){var e={init:function(e){var t=d.default._t("AssetAdmin.INSERT_FROM_FILES","Insert from Files"),o=d.default._t("AssetAdmin.EDIT_IMAGE","Edit image"),n=d.default._t("AssetAdmin.FILE","File");e.addCommand("ssmedia",function(){(0,r.default)("#"+e.id).entwine("ss").openMediaDialog()}),e.ui.registry.addButton("ssmedia",{tooltip:t,icon:"image",onAction:function(){return e.execCommand("ssmedia")},stateSelector:S}),e.ui.registry.addMenuItem("ssmedia",{text:n,icon:"image",onAction:function(){return e.execCommand("ssmedia")}}),e.ui.registry.addButton("ssmediaedit",{tooltip:o,icon:"edit-block",onAction:function(){return e.execCommand("ssmedia")}});var s=e.getParam("image_size_presets"),a=[];return s&&(a=(0,j.imageSizePresetButtons)(e,s)),e.ui.registry.addContextToolbar("ssmedia",{predicate:function(t){return e.dom.is(t,S)},position:"node",scope:"node",items:a.join(" ")+" | ssmediaedit"}),e.on("BeforeExecCommand",function(t){var o=t.command,n=t.ui,s=t.value;"mceEditImage"!==o&&"mceImage"!==o||(t.preventDefault(),e.execCommand("ssmedia",n,s))}),e.on("GetContent",function(e){var t=(0,r.default)(e.content);t.find(S).add(t.filter(S)).each(function(){var e=(0,r.default)(this),t={src:e.attr("src"),id:e.data("id"),width:e.attr("width"),height:e.attr("height"),class:e.attr("class"),title:e.attr("title"),alt:e.attr("alt"),loading:e.data("loading")},o=g.default.serialise({name:"image",properties:(0,v.sanitiseShortCodeProperties)(t),wrapped:!1});e.replaceWith(o)}),e.content="",t.each(function(){void 0!==this.outerHTML&&(e.content+=this.outerHTML)})}),e.on("BeforeSetContent",function(e){for(var t=e.content,o=g.default.match("image",!1,t);o;){var n=o.properties,s=(0,r.default)("").attr(Object.assign({},n,{id:void 0,"data-id":n.id,"data-shortcode":"image","data-loading":n.loading})).addClass("ss-htmleditorfield-file image");t=t.replace(o.original,(0,r.default)("
").append(s).html()),o=g.default.match("image",!1,t)}e.content=t}),{getMetadata:function(){return{name:"Silverstripe Media",url:"https://docs.silverstripe.org/en/4/developer_guides/forms/field_types/htmleditorfield"}}}}};tinymce.PluginManager.add("ssmedia",function(t){return e.init(t)})}(),r.default.entwine("ss",function(e){e(".js-injector-boot #insert-media-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){_.default.unmountComponentAtNode(this[0])},open:function(){var e=f.default.reducer.store.dispatch;e(x.initFormStack("insert-media","admin"));var t=tinymce.activeEditor.getParam("image_size_presets");e(x.defineImageSizePresets(t)),this._renderModal(!0)},close:function(){(0,f.default.reducer.store.dispatch)(x.reset()),this._renderModal(!1)},_renderModal:function(e){var t=this,o=function(){return t.close()},n=function(){return t._handleInsert.apply(t,arguments)},a=this.getOriginalAttributes(),r=(a.url,s(a,["url"])),i=r.hasOwnProperty("ID")&&null!==r.ID,d=this.getFolderId(),l=tinymce.activeEditor.selection,c=l.getContent()||"",h=l.getNode().tagName,f="A"!==h&&("IMG"===h||""===c.trim());_.default.render(u.default.createElement(b,{title:!1,isOpen:e,folderId:d,onInsert:n,onClosed:o,bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:f,fileAttributes:r,fileSelected:i}),this[0])},_handleInsert:function(e,t){var o=!1;this.setData(Object.assign({},e,t));try{switch(t?t.category:"image"){case"image":o=this.insertImage();break;default:o=this.insertFile()}}catch(e){this.statusMessage(e,"bad")}return o&&this.close(),Promise.resolve()},getFolderId:function(){var e=this.getElement();if(!e)return null;var t=Number(e.data("config").upload_folder_id);return isNaN(t)?null:t},getOriginalAttributes:function(){var t=this.getElement();if(!t)return{};var o=t.getEditor().getSelectedNode();if(!o)return{};var n=e(o),s=(n.attr("href")||"").split("#");if(s[0]){var a=g.default.match("file_link",!1,s[0]);if(a)return{ID:a.properties.id?parseInt(a.properties.id,10):0,Anchor:s[1]||"",Description:n.attr("title"),TargetBlank:!!n.attr("target")}}var r=n.parent(".captionImage").find(".caption"),i={url:n.attr("src"),AltText:n.attr("alt"),Width:n.attr("width"),Height:n.attr("height"),Loading:n.attr("data-loading"),TitleTooltip:n.attr("title"),Alignment:this.findPosition(n.attr("class")),Caption:r.text(),ID:n.attr("data-id")};return["Width","Height","ID"].forEach(function(e){i[e]="string"==typeof i[e]?parseInt(i[e],10):null}),i},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];if("string"!=typeof e)return"";var o=e.split(" ");return t.find(function(e){return o.indexOf(e)>-1})},getAttributes:function(){var e=this.getData();return{src:e.url,alt:e.AltText,width:e.Width,height:e.Height,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image","data-loading":e.Loading}},getExtraData:function(){var e=this.getData();return{CaptionText:e&&e.Caption}},insertFile:function(){var t=this.getData(),o=this.getElement().getEditor(),n=e(o.getSelectedNode()),s=g.default.serialise({name:"file_link",properties:{id:t.ID}},!0),a=tinymce.activeEditor.selection,r=a.getContent()||"",i=r||t.Text||t.filename;n.is("a")&&n.html()&&(i="");var d={href:s,target:t.TargetBlank?"_blank":"",title:t.Description};if(n.is("img")){i=t.Text||t.filename;var l=e("").attr(d).text(i);n.replaceWith(l),o.addUndo(),o.repaint()}else this.insertLinkInEditor(d,i);return!0},insertImage:function(){var t=this.getElement();if(!t)return!1;var o=t.getEditor();if(!o)return!1;var n=e(o.getSelectedNode()),s=this.getAttributes(),a=this.getExtraData(),r=n&&n.is("img,a")?n:null;r&&r.parent().is(".captionImage")&&(r=r.parent());var i=n&&n.is("img")?n:e("");i.attr(s).addClass("ss-htmleditorfield-file image");var d=i.parent(".captionImage"),l=d.find(".caption");a.CaptionText?(d.length||(d=e("
")),d.attr("class","captionImage "+s.class).removeAttr("data-mce-style").width(s.width),l.length||(l=e('

').appendTo(d)),l.attr("class","caption "+s.class).text(a.CaptionText)):(d=null,l=null);var u=d||i;return r&&r.not(u).length&&r.replaceWith(u),d&&d.prepend(i),r||(o.repaint(),o.insertContent(e("
").append(u).html(),{skip_undo:1})),o.addUndo(),o.repaint(),!0},statusMessage:function(t,o){var n=e("
").text(t).html();e.noticeAdd({text:n,type:o,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})}})})},"./client/src/entwine/TinyMCE_ssmedia_sizepressets.js":function(e,t,o){"use strict";function n(e,t){var o=t.name,n=t.width,s=t.text,a="ssmedia"+o;e.on("init",function(){e.formatter.register(a,{selector:"img",attributes:{width:n?n.toString():""}})});var r=function(){var t=e.selection.getNode();return t&&"IMG"===t.tagName?t:void 0},i=function(e){var t=r();e.disabled(!(!t||!n)&&t.naturalWidth1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:_.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:t}}}}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:_.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:t}}}}function d(){return{type:_.default.POP_FORM_SCHEMA}}function l(){return{type:_.default.RESET}}function u(){return{type:_.default.RESET_FORM_STACK}}Object.defineProperty(t,"__esModule",{value:!0}),t.defineImageSizePresets=s,t.stashFormValues=a,t.pushFormStackEntry=r,t.initFormStack=i,t.popFormStackEntry=d,t.reset=l,t.resetFormStack=u;var c=o("./client/src/state/modal/ModalActionTypes.js"),_=n(c),h=o("./node_modules/redux-form/lib/structure/plain/getIn.js"),f=n(h),m=o(8),p=o("./client/src/state/modal/helpers.js"),v=n(p)},"./client/src/state/modal/helpers.js":function(e,t,o){"use strict";function n(e,t){var o=void 0;for(o=0;o-1}var s=o("./node_modules/lodash/_assocIndexOf.js");e.exports=n},"./node_modules/lodash/_listCacheSet.js":function(e,t,o){function n(e,t){var o=this.__data__,n=s(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this}var s=o("./node_modules/lodash/_assocIndexOf.js");e.exports=n},"./node_modules/lodash/_mapCacheClear.js":function(e,t,o){function n(){this.size=0,this.__data__={hash:new s,map:new(r||a),string:new s}}var s=o("./node_modules/lodash/_Hash.js"),a=o("./node_modules/lodash/_ListCache.js"),r=o("./node_modules/lodash/_Map.js");e.exports=n},"./node_modules/lodash/_mapCacheDelete.js":function(e,t,o){function n(e){var t=s(this,e).delete(e);return this.size-=t?1:0,t}var s=o("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheGet.js":function(e,t,o){function n(e){return s(this,e).get(e)}var s=o("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheHas.js":function(e,t,o){function n(e){return s(this,e).has(e)}var s=o("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheSet.js":function(e,t,o){function n(e,t){var o=s(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this}var s=o("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_memoizeCapped.js":function(e,t,o){function n(e){var t=s(e,function(e){return o.size===a&&o.clear(),e}),o=t.cache;return t}var s=o("./node_modules/lodash/memoize.js"),a=500;e.exports=n},"./node_modules/lodash/_nativeCreate.js":function(e,t,o){var n=o("./node_modules/lodash/_getNative.js"),s=n(Object,"create");e.exports=s},"./node_modules/lodash/_objectToString.js":function(e,t){function o(e){return s.call(e)}var n=Object.prototype,s=n.toString;e.exports=o},"./node_modules/lodash/_root.js":function(e,t,o){var n=o("./node_modules/lodash/_freeGlobal.js"),s="object"==typeof self&&self&&self.Object===Object&&self,a=n||s||Function("return this")();e.exports=a},"./node_modules/lodash/_stringToPath.js":function(e,t,o){var n=o("./node_modules/lodash/_memoizeCapped.js"),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,r=n(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(s,function(e,o,n,s){t.push(n?s.replace(a,"$1"):o||e)}),t});e.exports=r},"./node_modules/lodash/_toKey.js":function(e,t,o){function n(e){if("string"==typeof e||s(e))return e;var t=e+"";return"0"==t&&1/e==-a?"-0":t}var s=o("./node_modules/lodash/isSymbol.js"),a=1/0;e.exports=n},"./node_modules/lodash/_toSource.js":function(e,t){function o(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=o},"./node_modules/lodash/eq.js":function(e,t){function o(e,t){return e===t||e!==e&&t!==t}e.exports=o},"./node_modules/lodash/isArray.js":function(e,t){var o=Array.isArray;e.exports=o},"./node_modules/lodash/isFunction.js":function(e,t,o){function n(e){if(!a(e))return!1;var t=s(e);return t==i||t==d||t==r||t==l}var s=o("./node_modules/lodash/_baseGetTag.js"),a=o("./node_modules/lodash/isObject.js"),r="[object AsyncFunction]",i="[object Function]",d="[object GeneratorFunction]",l="[object Proxy]";e.exports=n},"./node_modules/lodash/isObject.js":function(e,t){function o(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=o},"./node_modules/lodash/isObjectLike.js":function(e,t){function o(e){return null!=e&&"object"==typeof e}e.exports=o},"./node_modules/lodash/isSymbol.js":function(e,t,o){function n(e){return"symbol"==typeof e||a(e)&&s(e)==r}var s=o("./node_modules/lodash/_baseGetTag.js"),a=o("./node_modules/lodash/isObjectLike.js"),r="[object Symbol]";e.exports=n},"./node_modules/lodash/memoize.js":function(e,t,o){function n(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(a);var o=function(){var n=arguments,s=t?t.apply(this,n):n[0],a=o.cache;if(a.has(s))return a.get(s);var r=e.apply(this,n);return o.cache=a.set(s,r)||a,r};return o.cache=new(n.Cache||s),o}var s=o("./node_modules/lodash/_MapCache.js"),a="Expected a function";n.Cache=s,e.exports=n},"./node_modules/lodash/toPath.js":function(e,t,o){function n(e){return r(e)?s(e,l):i(e)?[e]:a(d(u(e)))}var s=o("./node_modules/lodash/_arrayMap.js"),a=o("./node_modules/lodash/_copyArray.js"),r=o("./node_modules/lodash/isArray.js"),i=o("./node_modules/lodash/isSymbol.js"),d=o("./node_modules/lodash/_stringToPath.js"),l=o("./node_modules/lodash/_toKey.js"),u=o("./node_modules/lodash/toString.js");e.exports=n},"./node_modules/lodash/toString.js":function(e,t,o){function n(e){return null==e?"":s(e)}var s=o("./node_modules/lodash/_baseToString.js");e.exports=n},"./node_modules/redux-form/lib/structure/plain/getIn.js":function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o("./node_modules/lodash/toPath.js"),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=function(e,t){if(!e)return e;var o=(0,s.default)(t),n=o.length;if(n){for(var a=e,r=0;r=0||Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);return o}var a=o(7),r=n(a),i=o(2),d=n(i),l=o(0),u=n(l),c=o(6),h=n(c),_=o(3),f=n(_),m=o(12),p=n(m),g=o(10),v=n(g),j=o("./client/src/entwine/TinyMCE_ssmedia_sizepressets.js"),y=o("./client/src/state/modal/ModalActions.js"),x=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t.default=e,t}(y),b=(0,_.loadComponent)(p.default),S='img[data-shortcode="image"]';!function(){var e={init:function(e){var t=d.default._t("AssetAdmin.INSERT_FROM_FILES","Insert from Files"),o=d.default._t("AssetAdmin.EDIT_IMAGE","Edit image"),n=d.default._t("AssetAdmin.FILE","File");e.addCommand("ssmedia",function(){(0,r.default)("#"+e.id).entwine("ss").openMediaDialog()}),e.ui.registry.addButton("ssmedia",{tooltip:t,icon:"image",onAction:function(){return e.execCommand("ssmedia")},stateSelector:S}),e.ui.registry.addMenuItem("ssmedia",{text:n,icon:"image",onAction:function(){return e.execCommand("ssmedia")}}),e.ui.registry.addButton("ssmediaedit",{tooltip:o,icon:"edit-block",onAction:function(){return e.execCommand("ssmedia")}});var s=e.getParam("image_size_presets"),a=[];return s&&(a=(0,j.imageSizePresetButtons)(e,s)),e.ui.registry.addContextToolbar("ssmedia",{predicate:function(t){return e.dom.is(t,S)},position:"node",scope:"node",items:a.join(" ")+" | ssmediaedit"}),e.on("BeforeExecCommand",function(t){var o=t.command,n=t.ui,s=t.value;"mceEditImage"!==o&&"mceImage"!==o||(t.preventDefault(),e.execCommand("ssmedia",n,s))}),e.on("GetContent",function(e){var t=(0,r.default)(e.content);t.find(S).add(t.filter(S)).each(function(){var e=(0,r.default)(this),t={src:e.attr("src"),id:e.data("id"),width:e.attr("width"),height:e.attr("height"),class:e.attr("class"),title:e.attr("title"),alt:e.attr("alt"),loading:e.data("loading")},o=v.default.serialise({name:"image",properties:(0,g.sanitiseShortCodeProperties)(t),wrapped:!1});e.replaceWith(o)}),e.content="",t.each(function(){void 0!==this.outerHTML&&(e.content+=this.outerHTML)})}),e.on("BeforeSetContent",function(e){for(var t=e.content,o=v.default.match("image",!1,t);o;){var n=o.properties,s=(0,r.default)("").attr(Object.assign({},n,{id:void 0,"data-id":n.id,"data-shortcode":"image","data-loading":n.loading})).addClass("ss-htmleditorfield-file image");t=t.replace(o.original,(0,r.default)("
").append(s).html()),o=v.default.match("image",!1,t)}e.content=t}),{getMetadata:function(){return{name:"Silverstripe Media",url:"https://docs.silverstripe.org/en/4/developer_guides/forms/field_types/htmleditorfield"}}}}};tinymce.PluginManager.add("ssmedia",function(t){return e.init(t)})}(),r.default.entwine("ss",function(e){e(".js-injector-boot #insert-media-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){h.default.unmountComponentAtNode(this[0])},open:function(){var e=f.default.reducer.store.dispatch;e(x.initFormStack("insert-media","admin"));var t=tinymce.activeEditor.getParam("image_size_presets");e(x.defineImageSizePresets(t)),this._renderModal(!0)},close:function(){(0,f.default.reducer.store.dispatch)(x.reset()),this._renderModal(!1)},_renderModal:function(e){var t=this,o=function(){return t.close()},n=function(){return t._handleInsert.apply(t,arguments)},a=this.getOriginalAttributes(),r=(a.url,s(a,["url"])),i=r.hasOwnProperty("ID")&&null!==r.ID,d=this.getFolderId(),l=this.getElement().getEditor(),c=l.getInstance().selection,_=l.getSelection(),f=c.getNode().tagName,m="A"!==f&&("IMG"===f||""===_.trim());h.default.render(u.default.createElement(b,{title:!1,isOpen:e,folderId:d,onInsert:n,onClosed:o,bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:m,fileAttributes:r,fileSelected:i}),this[0])},_handleInsert:function(e,t){var o=!1;this.setData(Object.assign({},e,t));try{switch(t?t.category:"image"){case"image":o=this.insertImage();break;default:o=this.insertFile()}}catch(e){this.statusMessage(e,"bad")}return o&&this.close(),Promise.resolve()},getFolderId:function(){var e=this.getElement();if(!e)return null;var t=Number(e.data("config").upload_folder_id);return isNaN(t)?null:t},getOriginalAttributes:function(){var t=this.getElement();if(!t)return{};var o=t.getEditor().getSelectedNode();if(!o)return{};var n=e(o),s=(n.attr("href")||"").split("#");if(s[0]){var a=v.default.match("file_link",!1,s[0]);if(a)return{ID:a.properties.id?parseInt(a.properties.id,10):0,Anchor:s[1]||"",Description:n.attr("title"),TargetBlank:!!n.attr("target")}}var r=n.parent(".captionImage").find(".caption"),i={url:n.attr("src"),AltText:n.attr("alt"),Width:n.attr("width"),Height:n.attr("height"),Loading:n.attr("data-loading"),TitleTooltip:n.attr("title"),Alignment:this.findPosition(n.attr("class")),Caption:r.text(),ID:n.attr("data-id")};return["Width","Height","ID"].forEach(function(e){i[e]="string"==typeof i[e]?parseInt(i[e],10):null}),i},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];if("string"!=typeof e)return"";var o=e.split(" ");return t.find(function(e){return o.indexOf(e)>-1})},getAttributes:function(){var e=this.getData();return{src:e.url,alt:e.AltText,width:e.Width,height:e.Height,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image","data-loading":e.Loading}},getExtraData:function(){var e=this.getData();return{CaptionText:e&&e.Caption}},insertFile:function(){var t=this.getData(),o=this.getElement().getEditor(),n=e(o.getSelectedNode()),s=v.default.serialise({name:"file_link",properties:{id:t.ID}},!0),a=this.getElement().getSelection(),r=a||t.Text||t.filename;n.is("a")&&n.html()&&(r="");var i={href:s,target:t.TargetBlank?"_blank":"",title:t.Description};if(n.is("img")){r=t.Text||t.filename;var d=e("").attr(i).text(r);n.replaceWith(d),o.addUndo(),o.repaint()}else this.insertLinkInEditor(i,r);return!0},insertImage:function(){var t=this.getElement();if(!t)return!1;var o=t.getEditor();if(!o)return!1;var n=e(o.getSelectedNode()),s=this.getAttributes(),a=this.getExtraData(),r=n&&n.is("img,a")?n:null;r&&r.parent().is(".captionImage")&&(r=r.parent());var i=n&&n.is("img")?n:e("");i.attr(s).addClass("ss-htmleditorfield-file image");var d=i.parent(".captionImage"),l=d.find(".caption");a.CaptionText?(d.length||(d=e("
")),d.attr("class","captionImage "+s.class).removeAttr("data-mce-style").width(s.width),l.length||(l=e('

').appendTo(d)),l.attr("class","caption "+s.class).text(a.CaptionText)):(d=null,l=null);var u=d||i;return r&&r.not(u).length&&r.replaceWith(u),d&&d.prepend(i),r||(o.repaint(),o.insertContent(e("
").append(u).html(),{skip_undo:1})),o.addUndo(),o.repaint(),!0},statusMessage:function(t,o){var n=e("
").text(t).html();e.noticeAdd({text:n,type:o,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})}})})},"./client/src/entwine/TinyMCE_ssmedia_sizepressets.js":function(e,t,o){"use strict";function n(e,t){var o=t.name,n=t.width,s=t.text,a="ssmedia"+o;e.on("init",function(){e.formatter.register(a,{selector:"img",attributes:{width:n?n.toString():""}})});var r=function(){var t=e.selection.getNode();return t&&"IMG"===t.tagName?t:void 0},i=function(e){var t=r();e.disabled(!(!t||!n)&&t.naturalWidth1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:h.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:t}}}}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:h.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:t}}}}function d(){return{type:h.default.POP_FORM_SCHEMA}}function l(){return{type:h.default.RESET}}function u(){return{type:h.default.RESET_FORM_STACK}}Object.defineProperty(t,"__esModule",{value:!0}),t.defineImageSizePresets=s,t.stashFormValues=a,t.pushFormStackEntry=r,t.initFormStack=i,t.popFormStackEntry=d,t.reset=l,t.resetFormStack=u;var c=o("./client/src/state/modal/ModalActionTypes.js"),h=n(c),_=o("./node_modules/redux-form/lib/structure/plain/getIn.js"),f=n(_),m=o(8),p=o("./client/src/state/modal/helpers.js"),g=n(p)},"./client/src/state/modal/helpers.js":function(e,t,o){"use strict";function n(e,t){var o=void 0;for(o=0;o-1}var s=o("./node_modules/lodash/_assocIndexOf.js");e.exports=n},"./node_modules/lodash/_listCacheSet.js":function(e,t,o){function n(e,t){var o=this.__data__,n=s(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this}var s=o("./node_modules/lodash/_assocIndexOf.js");e.exports=n},"./node_modules/lodash/_mapCacheClear.js":function(e,t,o){function n(){this.size=0,this.__data__={hash:new s,map:new(r||a),string:new s}}var s=o("./node_modules/lodash/_Hash.js"),a=o("./node_modules/lodash/_ListCache.js"),r=o("./node_modules/lodash/_Map.js");e.exports=n},"./node_modules/lodash/_mapCacheDelete.js":function(e,t,o){function n(e){var t=s(this,e).delete(e);return this.size-=t?1:0,t}var s=o("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheGet.js":function(e,t,o){function n(e){return s(this,e).get(e)}var s=o("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheHas.js":function(e,t,o){function n(e){return s(this,e).has(e)}var s=o("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_mapCacheSet.js":function(e,t,o){function n(e,t){var o=s(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this}var s=o("./node_modules/lodash/_getMapData.js");e.exports=n},"./node_modules/lodash/_memoizeCapped.js":function(e,t,o){function n(e){var t=s(e,function(e){return o.size===a&&o.clear(),e}),o=t.cache;return t}var s=o("./node_modules/lodash/memoize.js"),a=500;e.exports=n},"./node_modules/lodash/_nativeCreate.js":function(e,t,o){var n=o("./node_modules/lodash/_getNative.js"),s=n(Object,"create");e.exports=s},"./node_modules/lodash/_objectToString.js":function(e,t){function o(e){return s.call(e)}var n=Object.prototype,s=n.toString;e.exports=o},"./node_modules/lodash/_root.js":function(e,t,o){var n=o("./node_modules/lodash/_freeGlobal.js"),s="object"==typeof self&&self&&self.Object===Object&&self,a=n||s||Function("return this")();e.exports=a},"./node_modules/lodash/_stringToPath.js":function(e,t,o){var n=o("./node_modules/lodash/_memoizeCapped.js"),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,r=n(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(s,function(e,o,n,s){t.push(n?s.replace(a,"$1"):o||e)}),t});e.exports=r},"./node_modules/lodash/_toKey.js":function(e,t,o){function n(e){if("string"==typeof e||s(e))return e;var t=e+"";return"0"==t&&1/e==-a?"-0":t}var s=o("./node_modules/lodash/isSymbol.js"),a=1/0;e.exports=n},"./node_modules/lodash/_toSource.js":function(e,t){function o(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=o},"./node_modules/lodash/eq.js":function(e,t){function o(e,t){return e===t||e!==e&&t!==t}e.exports=o},"./node_modules/lodash/isArray.js":function(e,t){var o=Array.isArray;e.exports=o},"./node_modules/lodash/isFunction.js":function(e,t,o){function n(e){if(!a(e))return!1;var t=s(e);return t==i||t==d||t==r||t==l}var s=o("./node_modules/lodash/_baseGetTag.js"),a=o("./node_modules/lodash/isObject.js"),r="[object AsyncFunction]",i="[object Function]",d="[object GeneratorFunction]",l="[object Proxy]";e.exports=n},"./node_modules/lodash/isObject.js":function(e,t){function o(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=o},"./node_modules/lodash/isObjectLike.js":function(e,t){function o(e){return null!=e&&"object"==typeof e}e.exports=o},"./node_modules/lodash/isSymbol.js":function(e,t,o){function n(e){return"symbol"==typeof e||a(e)&&s(e)==r}var s=o("./node_modules/lodash/_baseGetTag.js"),a=o("./node_modules/lodash/isObjectLike.js"),r="[object Symbol]";e.exports=n},"./node_modules/lodash/memoize.js":function(e,t,o){function n(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(a);var o=function(){var n=arguments,s=t?t.apply(this,n):n[0],a=o.cache;if(a.has(s))return a.get(s);var r=e.apply(this,n);return o.cache=a.set(s,r)||a,r};return o.cache=new(n.Cache||s),o}var s=o("./node_modules/lodash/_MapCache.js"),a="Expected a function";n.Cache=s,e.exports=n},"./node_modules/lodash/toPath.js":function(e,t,o){function n(e){return r(e)?s(e,l):i(e)?[e]:a(d(u(e)))}var s=o("./node_modules/lodash/_arrayMap.js"),a=o("./node_modules/lodash/_copyArray.js"),r=o("./node_modules/lodash/isArray.js"),i=o("./node_modules/lodash/isSymbol.js"),d=o("./node_modules/lodash/_stringToPath.js"),l=o("./node_modules/lodash/_toKey.js"),u=o("./node_modules/lodash/toString.js");e.exports=n},"./node_modules/lodash/toString.js":function(e,t,o){function n(e){return null==e?"":s(e)}var s=o("./node_modules/lodash/_baseToString.js");e.exports=n},"./node_modules/redux-form/lib/structure/plain/getIn.js":function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o("./node_modules/lodash/toPath.js"),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=function(e,t){if(!e)return e;var o=(0,s.default)(t),n=o.length;if(n){for(var a=e,r=0;r { const handleInsert = (...args) => this.handleInsert(...args); const attrs = this.getOriginalAttributes(); - const selection = tinymce.activeEditor.selection; - const selectionContent = selection.getContent() || ''; + const editor = this.getElement().getEditor(); + const selection = editor.getInstance().selection; + const selectionContent = editor.getSelection(); const tagName = selection.getNode().tagName; const requireLinkText = tagName !== 'A' && selectionContent.trim() === ''; diff --git a/client/src/entwine/TinyMCE_ssmedia.js b/client/src/entwine/TinyMCE_ssmedia.js index f2afdf875..ce579f41f 100644 --- a/client/src/entwine/TinyMCE_ssmedia.js +++ b/client/src/entwine/TinyMCE_ssmedia.js @@ -204,8 +204,9 @@ jQuery.entwine('ss', ($) => { const { url, ...attrs } = this.getOriginalAttributes(); const fileSelected = attrs.hasOwnProperty('ID') && attrs.ID !== null; const folderId = this.getFolderId(); - const selection = tinymce.activeEditor.selection; - const selectionContent = selection.getContent() || ''; + const editor = this.getElement().getEditor(); + const selection = editor.getInstance().selection; + const selectionContent = editor.getSelection(); const tagName = selection.getNode().tagName; // Unsupported media insertion will use insert link form instead // treat image tag selection as blank content @@ -408,8 +409,7 @@ jQuery.entwine('ss', ($) => { properties: { id: data.ID }, }, true); - const selection = tinymce.activeEditor.selection; - const selectionContent = selection.getContent() || ''; + const selectionContent = this.getElement().getSelection(); let linkText = selectionContent || data.Text || data.filename; // if link was highlighted, then we don't want to place more text inside that text