diff --git a/_config.php b/_config.php index 50237c79c..0033c3649 100644 --- a/_config.php +++ b/_config.php @@ -19,4 +19,8 @@ ]); $config->insertButtonsAfter('table', 'ssmedia'); $config->insertButtonsAfter('ssmedia', 'ssembed'); + + $validElements = $config->getOption('extended_valid_elements'); + $validElements .= ",figure[class|data*|id|style|title],figcaption[class|data*|id|style|title]"; + $config->setOption('extended_valid_elements', $validElements); }); diff --git a/client/dist/js/TinyMCE_ssembed.js b/client/dist/js/TinyMCE_ssembed.js index 8283c704b..24b8ab153 100644 --- a/client/dist/js/TinyMCE_ssembed.js +++ b/client/dist/js/TinyMCE_ssembed.js @@ -1 +1 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s="./client/src/entwine/TinyMCE_ssembed.js")}({"./client/src/components/InsertEmbedModal/InsertEmbedModal.js":function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){var n=e.config.sections.find(function(e){return e.name===E}),r=t.fileAttributes?t.fileAttributes.Url:"",i=n.form.remoteEditForm.schemaUrl,a=r&&i+"/?embedurl="+encodeURIComponent(r),o=n.form.remoteCreateForm.schemaUrl;return{sectionConfig:n,schemaUrl:a||o,targetUrl:r}}function l(e){return{actions:{schema:(0,m.bindActionCreators)(_,e)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;var d=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n"+e.content+"");t.find(v).each(function(){var e=(0,a.default)(this),t=e.find("img.placeholder");if(0===t.length)return e.removeAttr("data-url"),void e.removeAttr("data-shortcode");var n=e.find(".caption").text(),r=parseInt(t.attr("width"),10),i=parseInt(t.attr("height"),10),o=e.data("url"),s=(0,c.sanitiseShortCodeProperties)({url:o,thumbnail:t.prop("src"),class:e.prop("class"),width:isNaN(r)?null:r,height:isNaN(i)?null:i,caption:n}),l=f.default.serialise({name:"embed",properties:s,wrapped:!0,content:s.url});e.replaceWith(l)}),e.content=t.html()}),e.on("BeforeSetContent",function(e){for(var t=e.content,n=f.default.match("embed",!0,t);n;){var r=n.properties,i=(0,a.default)("
").attr("data-url",r.url||n.content).attr("data-shortcode","embed").addClass(r.class).addClass("ss-htmleditorfield-file embed"),o=(0,a.default)("").attr("src",r.thumbnail).addClass("placeholder");if(r.width&&o.attr("width",r.width),r.height&&o.attr("height",r.height),i.append(o),r.caption){var s=(0,a.default)("

").addClass("caption").text(r.caption);i.append(s)}t=t.replace(n.original,(0,a.default)("

").append(i).html()),n=f.default.match("embed",!0,t)}e.content=t})}};tinymce.PluginManager.add("ssembed",function(t){return e.init(t)})}(),a.default.entwine("ss",function(e){e(".js-injector-boot #insert-embed-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){d.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this.setData({}),this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=function(){return t._handleCreate.apply(t,arguments)},a=function(){return t._handleLoadingError.apply(t,arguments)},o=this.getOriginalAttributes();d.default.render(s.default.createElement(b,{isOpen:e,onCreate:i,onInsert:r,onClosed:n,onLoadingError:a,bodyClassName:"modal__dialog",className:"insert-embed-react__dialog-wrapper",fileAttributes:o}),this[0])},_handleLoadingError:function(){this.setData({}),this.open()},_handleInsert:function(e){var t=this.getData();this.setData(Object.assign({Url:t.Url},e)),this.insertRemote(),this.close()},_handleCreate:function(e){this.setData(Object.assign({},this.getData(),e)),this.open()},getOriginalAttributes:function(){var t=this.getData(),n=this.getElement();if(!n)return t;var r=e(n.getEditor().getSelectedNode());if(!r.length)return t;var i=r.closest(v).add(r.filter(v));if(!i.length)return t;var a=i.find("img.placeholder");if(0===a.length)return t;var o=i.find(".caption").text(),s=parseInt(a.width(),10),l=parseInt(a.height(),10);return{Url:i.data("url")||t.Url,CaptionText:o,PreviewUrl:a.attr("src"),Width:isNaN(s)?null:s,Height:isNaN(l)?null:l,Placement:this.findPosition(i.prop("class"))}},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];if("string"!=typeof e)return"";var n=e.split(" ");return t.find(function(e){return n.indexOf(e)>-1})},insertRemote:function(){var t=this.getElement();if(!t)return!1;var n=t.getEditor();if(!n)return!1;var r=this.getData(),i=(0,a.default)("
").attr("data-url",r.Url).attr("data-shortcode","embed").addClass(r.Placement).addClass("ss-htmleditorfield-file embed"),o=(0,a.default)("").attr("src",r.PreviewUrl).addClass("placeholder");if(r.Width&&o.attr("width",r.Width),r.Height&&o.attr("height",r.Height),i.append(o),r.CaptionText){var s=(0,a.default)("

").addClass("caption").text(r.CaptionText);i.append(s)}var l=e(n.getSelectedNode()),d=e(null);return l.length&&(d=l.filter(v),0===d.length&&(d=l.closest(v)),0===d.length&&(d=l.filter("img.placeholder"))),d.length?d.replaceWith(i):(n.repaint(),n.insertContent(e("

").append(i.clone()).html(),{skip_undo:1})),n.addUndo(),n.repaint(),!0}})})},0:function(e,t){e.exports=React},1:function(e,t){e.exports=PropTypes},10:function(e,t){e.exports=ShortcodeSerialiser},13:function(e,t){e.exports=FormBuilderModal},2:function(e,t){e.exports=i18n},3:function(e,t){e.exports=Injector},4:function(e,t){e.exports=ReactRedux},5:function(e,t){e.exports=Redux},6:function(e,t){e.exports=ReactDom},7:function(e,t){e.exports=jQuery},8:function(e,t){e.exports=SchemaActions}}); \ No newline at end of file +!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s="./client/src/entwine/TinyMCE_ssembed.js")}({"./client/src/components/InsertEmbedModal/InsertEmbedModal.js":function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){var n=e.config.sections.find(function(e){return e.name===E}),r=t.fileAttributes?t.fileAttributes.Url:"",i=n.form.remoteEditForm.schemaUrl,a=r&&i+"/?embedurl="+encodeURIComponent(r),o=n.form.remoteCreateForm.schemaUrl;return{sectionConfig:n,schemaUrl:a||o,targetUrl:r}}function l(e){return{actions:{schema:(0,m.bindActionCreators)(C,e)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;var d=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n"+e.content+"
");t.find(v).each(function(){var e=(0,a.default)(this),t=e.find("img.placeholder");if(0===t.length)return e.removeAttr("data-url"),void e.removeAttr("data-shortcode");var n=e.find(".caption").text(),r=parseInt(t.attr("width"),10),i=parseInt(t.attr("height"),10),o=e.data("url"),s=(0,c.sanitiseShortCodeProperties)({url:o,thumbnail:t.prop("src"),class:e.prop("class"),width:isNaN(r)?null:r,height:isNaN(i)?null:i,caption:n}),l=f.default.serialise({name:"embed",properties:s,wrapped:!0,content:s.url});e.replaceWith(l)}),e.content=t.html()}),e.on("BeforeSetContent",function(e){for(var t=e.content,n=f.default.match("embed",!0,t);n;){var r=n.properties,i=(r.caption?(0,a.default)("
"):(0,a.default)("
")).attr("data-url",r.url||n.content).attr("data-shortcode","embed").addClass(r.class).addClass("ss-htmleditorfield-file embed"),o=(0,a.default)("").attr("src",r.thumbnail).addClass("placeholder");if(r.width&&o.attr("width",r.width),r.height&&o.attr("height",r.height),i.append(o),r.caption){var s=(0,a.default)("
").addClass("caption").text(r.caption);i.append(s)}t=t.replace(n.original,(0,a.default)("
").append(i).html()),n=f.default.match("embed",!0,t)}e.content=t})}};tinymce.PluginManager.add("ssembed",function(t){return e.init(t)})}(),a.default.entwine("ss",function(e){e(".js-injector-boot #insert-embed-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){d.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this.setData({}),this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=function(){return t._handleCreate.apply(t,arguments)},a=function(){return t._handleLoadingError.apply(t,arguments)},o=this.getOriginalAttributes();d.default.render(s.default.createElement(b,{isOpen:e,onCreate:i,onInsert:r,onClosed:n,onLoadingError:a,bodyClassName:"modal__dialog",className:"insert-embed-react__dialog-wrapper",fileAttributes:o}),this[0])},_handleLoadingError:function(){this.setData({}),this.open()},_handleInsert:function(e){var t=this.getData();this.setData(Object.assign({Url:t.Url},e)),this.insertRemote(),this.close()},_handleCreate:function(e){this.setData(Object.assign({},this.getData(),e)),this.open()},getOriginalAttributes:function(){var t=this.getData(),n=this.getElement();if(!n)return t;var r=e(n.getEditor().getSelectedNode());if(!r.length)return t;var i=r.closest(v).add(r.filter(v));if(!i.length)return t;var a=i.find("img.placeholder");if(0===a.length)return t;var o=i.find(".caption").text(),s=parseInt(a.width(),10),l=parseInt(a.height(),10);return{Url:i.data("url")||t.Url,CaptionText:o,PreviewUrl:a.attr("src"),Width:isNaN(s)?null:s,Height:isNaN(l)?null:l,Placement:this.findPosition(i.prop("class"))}},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];if("string"!=typeof e)return"";var n=e.split(" ");return t.find(function(e){return n.indexOf(e)>-1})},insertRemote:function(){var t=this.getElement();if(!t)return!1;var n=t.getEditor();if(!n)return!1;var r=this.getData();console.log(r);var i=(r.CaptionText?(0,a.default)("
"):(0,a.default)("
")).attr("data-url",r.Url).attr("data-shortcode","embed").addClass(r.Placement).addClass("ss-htmleditorfield-file embed"),o=(0,a.default)("").attr("src",r.PreviewUrl).addClass("placeholder");if(r.Width&&o.attr("width",r.Width),r.Height&&o.attr("height",r.Height),i.append(o),r.CaptionText){var s=(0,a.default)("
").addClass("caption").text(r.CaptionText);i.append(s)}var l=e(n.getSelectedNode()),d=e(null);return l.length&&(d=l.filter(v),0===d.length&&(d=l.closest(v)),0===d.length&&(d=l.filter("img.placeholder"))),d.length?d.replaceWith(i):(n.repaint(),n.insertContent(e("
").append(i.clone()).html(),{skip_undo:1})),n.addUndo(),n.repaint(),!0}})})},0:function(e,t){e.exports=React},1:function(e,t){e.exports=PropTypes},10:function(e,t){e.exports=ShortcodeSerialiser},13:function(e,t){e.exports=FormBuilderModal},2:function(e,t){e.exports=i18n},3:function(e,t){e.exports=Injector},4:function(e,t){e.exports=ReactRedux},5:function(e,t){e.exports=Redux},6:function(e,t){e.exports=ReactDom},7:function(e,t){e.exports=jQuery},8:function(e,t){e.exports=SchemaActions}}); \ No newline at end of file diff --git a/client/dist/js/TinyMCE_ssmedia.js b/client/dist/js/TinyMCE_ssmedia.js index aa2999028..667f7562e 100644 --- a/client/dist/js/TinyMCE_ssmedia.js +++ b/client/dist/js/TinyMCE_ssmedia.js @@ -1 +1 @@ -!function(e){function t(n){if(o[n])return o[n].exports;var s=o[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var o={};t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s="./client/src/entwine/TinyMCE_ssmedia.js")}({"./client/src/entwine/TinyMCE_ssmedia.js":function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function s(e,t){var o={};for(var n in e)t.indexOf(n)>=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"),b=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),x=(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.addButton("ssmedia",{title:t,icon:"image",cmd:"ssmedia",stateSelector:S}),e.addMenuItem("ssmedia",{text:n,icon:"image",cmd:"ssmedia"}),e.addButton("ssmediaedit",{title:o,icon:"editimage",cmd:"ssmedia"});var s=e.getParam("image_size_presets"),a=[];s&&(a=(0,j.imageSizePresetButtons)(e,s)),e.addContextToolbar(function(t){return e.dom.is(t,S)},a.join(" ")+" | ssmediaedit"),e.addCommand("ssmedia",function(){(0,r.default)("#"+e.id).entwine("ss").openMediaDialog()}),e.on("BeforeExecCommand",function(t){var o=t.command,n=t.ui,s=t.value;"mceAdvImage"!==o&&"mceImage"!==o||(t.preventDefault(),e.execCommand("ssmedia",n,s))}),e.on("SaveContent",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})}};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(b.initFormStack("insert-media","admin"));var t=tinymce.activeEditor.getParam("image_size_presets");e(b.defineImageSizePresets(t)),this._renderModal(!0)},close:function(){(0,f.default.reducer.store.dispatch)(b.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(x,{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),_=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"),b=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),x=(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.addButton("ssmedia",{title:t,icon:"image",cmd:"ssmedia",stateSelector:S}),e.addMenuItem("ssmedia",{text:n,icon:"image",cmd:"ssmedia"}),e.addButton("ssmediaedit",{title:o,icon:"editimage",cmd:"ssmedia"});var s=e.getParam("image_size_presets"),a=[];s&&(a=(0,j.imageSizePresetButtons)(e,s)),e.addContextToolbar(function(t){return e.dom.is(t,S)},a.join(" ")+" | ssmediaedit"),e.addCommand("ssmedia",function(){(0,r.default)("#"+e.id).entwine("ss").openMediaDialog()}),e.on("BeforeExecCommand",function(t){var o=t.command,n=t.ui,s=t.value;"mceAdvImage"!==o&&"mceImage"!==o||(t.preventDefault(),e.execCommand("ssmedia",n,s))}),e.on("SaveContent",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})}};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(b.initFormStack("insert-media","admin"));var t=tinymce.activeEditor.getParam("image_size_presets");e(b.defineImageSizePresets(t)),this._renderModal(!0)},close:function(){(0,f.default.reducer.store.dispatch)(b.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(x,{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 element and an inner @@ -109,7 +109,7 @@ const filter = 'div[data-shortcode="embed"]'; const data = match.properties; // Add base div - const base = jQuery('
') + const base = (data.caption ? jQuery('
') : jQuery('
')) .attr('data-url', data.url || match.content) .attr('data-shortcode', 'embed') .addClass(data.class) @@ -130,9 +130,9 @@ const filter = 'div[data-shortcode="embed"]'; base.append(placeholder); - // Add caption p tag + // Add caption tag if (data.caption) { - const caption = jQuery('

') + const caption = jQuery('

') .addClass('caption') .text(data.caption); base.append(caption); @@ -307,9 +307,10 @@ jQuery.entwine('ss', ($) => { } const data = this.getData(); + console.log(data); // Add base div - const base = jQuery('
') + const base = (data.CaptionText ? jQuery('
') : jQuery('
')) .attr('data-url', data.Url) .attr('data-shortcode', 'embed') .addClass(data.Placement) @@ -331,9 +332,9 @@ jQuery.entwine('ss', ($) => { // Add to base base.append(placeholder); - // Add caption p tag + // Add caption tag if (data.CaptionText) { - const caption = jQuery('

') + const caption = jQuery('

') .addClass('caption') .text(data.CaptionText); base.append(caption); diff --git a/client/src/entwine/TinyMCE_ssmedia.js b/client/src/entwine/TinyMCE_ssmedia.js index 1589429a8..43cb0191a 100644 --- a/client/src/entwine/TinyMCE_ssmedia.js +++ b/client/src/entwine/TinyMCE_ssmedia.js @@ -454,10 +454,10 @@ jQuery.entwine('ss', ($) => { let container = img.parent('.captionImage'); let caption = container.find('.caption'); - // If we've got caption text, we need a wrapping div.captionImage and sibling p.caption + // If we've got a caption, we transform to figure.captionImage and figcaption.caption if (extraData.CaptionText) { if (!container.length) { - container = $('
'); + container = $('
'); } container @@ -466,7 +466,7 @@ jQuery.entwine('ss', ($) => { .width(attrs.width); if (!caption.length) { - caption = $('

').appendTo(container); + caption = $('
').appendTo(container); } caption.attr('class', `caption ${attrs.class}`).text(extraData.CaptionText);