silverstripe-cms/client/dist/js/TinyMCE_sslink-internal.js

1 line
3.2 KiB
JavaScript
Raw Normal View History

!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=26)}([function(e,t){e.exports=jQuery},function(e,t){e.exports=i18n},function(e,t){e.exports=Injector},function(e,t){e.exports=React},function(e,t){e.exports=InsertLinkModal},function(e,t){e.exports=ReactApollo},function(e,t){e.exports=ReactDom},function(e,t){e.exports=ShortcodeSerialiser},function(e,t){e.exports=TinyMCEActionRegistrar},,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(8),l=r(a),s=n(3),u=r(s),d=n(6),c=r(d),f=n(5),p=n(0),g=r(p),k=n(7),m=r(k),h=n(4),_=n(2);l.default.addAction("sslink",{text:o.default._t("CMS.LINKLABEL_PAGE","Page on this site"),onclick:function(e){return e.execCommand("sslinkinternal")},priority:53}).addCommandWithUrlTest("sslinkinternal",/^\[sitetree_link.+]$/);var x={init:function(e){e.addCommand("sslinkinternal",function(){(0,g.default)("#"+e.id).entwine("ss").openLinkInternalDialog()})}},A="insert-link__dialog-wrapper--internal",I=(0,_.provideInjector)((0,h.createInsertLinkModal)("SilverStripe\\CMS\\Controllers\\CMSPageEditController","editorInternalLink"));g.default.entwine("ss",function(e){e("textarea.htmleditor").entwine({openLinkInternalDialog:function(){var t=e("#"+A);t.length||(t=e('<div id="'+A+'" />'),e("body").append(t)),t.addClass("insert-link__dialog-wrapper"),t.setElement(this),t.open()}}),e("#"+A).entwine({renderModal:function(e){var t=this,n=ss.store,r=ss.apolloClient,i=function(){return t.close()},a=function(){return t.handleInsert.apply(t,arguments)},l=this.getOriginalAttributes(),s=this.getRequireLinkText();c.default.render(u.default.createElement(f.ApolloProvider,{store:n,client:r},u.default.createElement(I,{show:e,onInsert:a,onHide:i,title:o.default._t("CMS.LINK_PAGE","Link to a page"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:l,identifier:"Admin.InsertLinkInternalModal",requireLinkText:s})),this[0])},getRequireLinkText:function(){var e=this.getElement().getEditor().getInstance().selection,t=e.getContent()||"";return"A"!==e.getNode().tagName&&""===t.trim()},buildAttributes:function(e){return{href:m.default.serialise({name:"sitetree_link",properties:{id:e.PageID}},!0)+(e.Anchor&&e.Anchor.length?"#"+e.Anchor:""),target:e.TargetBlank?"_blank":"",title:e.Description}},getOriginalAttributes:function(){var t=this.getElement().getEditor(),n=e(t.getSelectedNode()),r=(n.attr("href")||"").split("#");if(!r[0])return{};var i=m.default.match("sitetree_link",!1,r[0]);return i?{PageID:i.properties.id?parseInt(i.properties.id,10):0,Anchor:r[1]||"",Description:n.attr("title"),TargetBlank:!!n.attr("target")}:{}}})}),tinymce.PluginManager.add("sslinkinternal",function(e){return x.init(e)}),t.default=x}]);