silverstripe-cms/client/dist/js/TinyMCE_sslink-internal.js
Guy Sartorelli ef4122da04
ENH Use the EmotionCssCacheProvider component
This ensures we can override the react-select CSS if we need to.
2023-01-11 16:06:36 +13:00

1 line
2.9 KiB
JavaScript

!function(){"use strict";var t={745:function(t,e,n){var i=n(394);e.createRoot=i.createRoot,e.hydrateRoot=i.hydrateRoot},939:function(t){t.exports=ApolloClient},648:function(t){t.exports=Injector},595:function(t){t.exports=InsertLinkModal},363:function(t){t.exports=React},394:function(t){t.exports=ReactDom},624:function(t){t.exports=ReactRedux},265:function(t){t.exports=ShortcodeSerialiser},196:function(t){t.exports=TinyMCEActionRegistrar},754:function(t){t.exports=i18n},311:function(t){t.exports=jQuery}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}!function(){var t=u(n(754)),e=u(n(196)),i=u(n(363)),r=n(745),o=n(939),a=n(624),s=u(n(311)),l=u(n(265)),d=n(595),c=n(648);function u(t){return t&&t.__esModule?t:{default:t}}const p="sslinkinternal";e.default.addAction("sslink",{text:t.default._t("CMS.LINKLABEL_PAGE","Page on this site"),onAction:t=>t.execCommand(p),priority:90},editorIdentifier).addCommandWithUrlTest(p,/^\[sitetree_link.+]$/);const g={init(t){t.addCommand(p,(()=>{(0,s.default)(`#${t.id}`).entwine("ss").openLinkInternalDialog()}))}},f="insert-link__dialog-wrapper--internal",h=(0,c.provideInjector)((0,d.createInsertLinkModal)("SilverStripe\\CMS\\Controllers\\CMSPageEditController","editorInternalLink"));s.default.entwine("ss",(e=>{e("textarea.htmleditor").entwine({openLinkInternalDialog(){let t=e(`#${f}`);t.length||(t=e(`<div id="${f}" />`),e("body").append(t)),t.addClass("insert-link__dialog-wrapper"),t.setElement(this),t.open()}}),e(`#${f}`).entwine({ReactRoot:null,renderModal(e){var n=this;const s=ss.store,l=ss.apolloClient,d=this.getOriginalAttributes(),c=this.getRequireLinkText();let u=this.getReactRoot();u||(u=(0,r.createRoot)(this[0]),this.setReactRoot(u)),u.render(i.default.createElement(o.ApolloProvider,{client:l},i.default.createElement(a.Provider,{store:s},i.default.createElement(h,{isOpen:e,onInsert:function(){return n.handleInsert(...arguments)},onClosed:()=>this.close(),title:t.default._t("CMS.LINK_PAGE","Link to a page"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:d,identifier:"Admin.InsertLinkInternalModal",requireLinkText:c}))))},getRequireLinkText(){const t=this.getElement().getEditor(),e=t.getInstance().selection,n=t.getSelection();return"A"!==e.getNode().tagName&&""===n.trim()},buildAttributes(t){return{href:`${l.default.serialise({name:"sitetree_link",properties:{id:t.PageID}},!0)}${t.Anchor&&t.Anchor.length?`#${t.Anchor}`:""}`,target:t.TargetBlank?"_blank":"",title:t.Description}},getOriginalAttributes(){const t=this.getElement().getEditor(),n=e(t.getSelectedNode()),i=(n.attr("href")||"").split("#");if(!i[0])return{};const r=l.default.match("sitetree_link",!1,i[0]);return r?{PageID:r.properties.id?parseInt(r.properties.id,10):0,Anchor:i[1]||"",Description:n.attr("title"),TargetBlank:!!n.attr("target")}:{}}})})),tinymce.PluginManager.add(p,(t=>g.init(t)))}()}();