diff --git a/_config/config.yml b/_config/config.yml index 47a7621559..a179cf9e0e 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -9,11 +9,12 @@ SilverStripe\Admin\LeftAndMain: Name: cmsmodals --- SilverStripe\Admin\ModalController: - extensions: - - SilverStripe\CMS\Forms\InternalLinkModalExtension + link_modal_form_factories: + editorInternalLink: SilverStripe\CMS\Forms\InternalLinkFormFactory + editorAnchorLink: SilverStripe\CMS\Forms\AnchorLinkFormFactory --- Name: cmshierarchy --- SilverStripe\ORM\Hierarchy\Hierarchy: node_threshold_total: 50 - node_threshold_leaf: 250 \ No newline at end of file + node_threshold_leaf: 250 diff --git a/client/dist/js/TinyMCE_sslink-anchor.js b/client/dist/js/TinyMCE_sslink-anchor.js index 767ec55e02..9e7d431d73 100644 --- a/client/dist/js/TinyMCE_sslink-anchor.js +++ b/client/dist/js/TinyMCE_sslink-anchor.js @@ -1 +1 @@ -!function(){"use strict";var e={803:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={ANCHORSELECTOR_CURRENT_FIELD:"ANCHORSELECTOR_CURRENT_FIELD",ANCHORSELECTOR_UPDATED:"ANCHORSELECTOR_UPDATED",ANCHORSELECTOR_UPDATING:"ANCHORSELECTOR_UPDATING",ANCHORSELECTOR_UPDATE_FAILED:"ANCHORSELECTOR_UPDATE_FAILED"}},979:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.beginUpdating=function(e){return{type:i.default.ANCHORSELECTOR_UPDATING,payload:{pageId:e}}},t.updateFailed=function(e){return{type:i.default.ANCHORSELECTOR_UPDATE_FAILED,payload:{pageId:e}}},t.updated=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{type:i.default.ANCHORSELECTOR_UPDATED,payload:{pageId:e,anchors:t,cacheResult:n}}},t.updatedCurrentField=function(e,t,n){return{type:i.default.ANCHORSELECTOR_CURRENT_FIELD,payload:{pageId:e,anchors:t,fieldID:n}}};var r,i=(r=n(803))&&r.__esModule?r:{default:r}},207:function(e){e.exports=Injector},127:function(e){e.exports=InsertLinkModal},594:function(e){e.exports=React},145:function(e){e.exports=ReactDomClient},40:function(e){e.exports=ReactRedux},502:function(e){e.exports=ShortcodeSerialiser},153:function(e){e.exports=TinyMCEActionRegistrar},815:function(e){e.exports=i18n},669:function(e){e.exports=jQuery}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}!function(){var e=c(n(815)),t=c(n(153)),r=c(n(594)),i=n(145),o=n(40),a=c(n(669)),d=c(n(502)),l=n(127),s=n(207),u=n(979);function c(e){return e&&e.__esModule?e:{default:e}}const p="sslinkanchor",f={init(n){t.default.addAction("sslink",{text:e.default._t("CMS.LINKLABEL_ANCHOR","Anchor on a page"),onAction:e=>e.execCommand(p),priority:60},n.getParam("editorIdentifier")).addCommandWithUrlTest(p,/^\[sitetree_link.+]#[^#\]]+$/),n.addCommand(p,(()=>{const e=(0,a.default)(`#${n.id}`).entwine("ss"),t=Number((0,a.default)("#Form_EditForm_ID").val()||0),r=(0,a.default)(n.getBody()).find("[id],[name]").toArray().map((e=>e.id||e.name));ss.store.dispatch((0,u.updatedCurrentField)(t,r,n.id)),e.openLinkAnchorDialog()}))}},E="insert-link__dialog-wrapper--anchor",R=(0,s.provideInjector)((0,l.createInsertLinkModal)("SilverStripe\\CMS\\Controllers\\CMSPageEditController","editorAnchorLink"));a.default.entwine("ss",(t=>{t("textarea.htmleditor").entwine({openLinkAnchorDialog(){let e=t(`#${E}`);e.length||(e=t(`
`),t("body").append(e)),e.addClass("insert-link__dialog-wrapper"),e.setElement(this),e.open()}}),t(`#${E}`).entwine({ReactRoot:null,renderModal(n){var a=this;const d=ss.store,l=this.getOriginalAttributes(),s=this.getRequireLinkText(),u=Number(t("#Form_EditForm_ID").val()||0);let c=this.getReactRoot();c||(c=(0,i.createRoot)(this[0]),this.setReactRoot(c)),c.render(r.default.createElement(o.Provider,{store:d},r.default.createElement(R,{isOpen:n,onInsert:function(){return a.handleInsert(...arguments)},onClosed:()=>this.close(),title:e.default._t("CMS.LINK_ANCHOR","Link to an anchor on a page"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--anchor",fileAttributes:l,identifier:"Admin.InsertLinkAnchorModal",requireLinkText:s,currentPageID:u})))},buildAttributes(e){return{href:`${d.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(){const e=this.getElement().getEditor(),n=t(e.getSelectedNode()),r=(n.attr("href")||"").split("#");if(!r[0])return{};const i=d.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(p,(e=>f.init(e)))}()}(); \ No newline at end of file +!function(){"use strict";var e={803:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={ANCHORSELECTOR_CURRENT_FIELD:"ANCHORSELECTOR_CURRENT_FIELD",ANCHORSELECTOR_UPDATED:"ANCHORSELECTOR_UPDATED",ANCHORSELECTOR_UPDATING:"ANCHORSELECTOR_UPDATING",ANCHORSELECTOR_UPDATE_FAILED:"ANCHORSELECTOR_UPDATE_FAILED"}},979:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.beginUpdating=function(e){return{type:i.default.ANCHORSELECTOR_UPDATING,payload:{pageId:e}}},t.updateFailed=function(e){return{type:i.default.ANCHORSELECTOR_UPDATE_FAILED,payload:{pageId:e}}},t.updated=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{type:i.default.ANCHORSELECTOR_UPDATED,payload:{pageId:e,anchors:t,cacheResult:n}}},t.updatedCurrentField=function(e,t,n){return{type:i.default.ANCHORSELECTOR_CURRENT_FIELD,payload:{pageId:e,anchors:t,fieldID:n}}};var r,i=(r=n(803))&&r.__esModule?r:{default:r}},207:function(e){e.exports=Injector},127:function(e){e.exports=InsertLinkModal},594:function(e){e.exports=React},145:function(e){e.exports=ReactDomClient},40:function(e){e.exports=ReactRedux},502:function(e){e.exports=ShortcodeSerialiser},153:function(e){e.exports=TinyMCEActionRegistrar},815:function(e){e.exports=i18n},669:function(e){e.exports=jQuery}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}!function(){var e=c(n(815)),t=c(n(153)),r=c(n(594)),i=n(145),a=n(40),o=c(n(669)),d=c(n(502)),l=n(127),s=n(207),u=n(979);function c(e){return e&&e.__esModule?e:{default:e}}const p="sslinkanchor",f={init(n){t.default.addAction("sslink",{text:e.default._t("CMS.LINKLABEL_ANCHOR","Anchor on a page"),onAction:e=>e.execCommand(p),priority:60},n.getParam("editorIdentifier")).addCommandWithUrlTest(p,/^\[sitetree_link.+]#[^#\]]+$/),n.addCommand(p,(()=>{const e=(0,o.default)(`#${n.id}`).entwine("ss"),t=Number((0,o.default)("#Form_EditForm_ID").val()||0),r=(0,o.default)(n.getBody()).find("[id],[name]").toArray().map((e=>e.id||e.name));ss.store.dispatch((0,u.updatedCurrentField)(t,r,n.id)),e.openLinkAnchorDialog()}))}},E="insert-link__dialog-wrapper--anchor",A=(0,s.provideInjector)((0,l.createInsertLinkModal)("SilverStripe\\Admin\\LeftAndMain","editorAnchorLink"));o.default.entwine("ss",(t=>{t("textarea.htmleditor").entwine({openLinkAnchorDialog(){let e=t(`#${E}`);e.length||(e=t(`
`),t("body").append(e)),e.addClass("insert-link__dialog-wrapper"),e.setElement(this),e.open()}}),t(`#${E}`).entwine({ReactRoot:null,renderModal(n){var o=this;const d=ss.store,l=this.getOriginalAttributes(),s=this.getRequireLinkText(),u=Number(t("#Form_EditForm_ID").val()||0);let c=this.getReactRoot();c||(c=(0,i.createRoot)(this[0]),this.setReactRoot(c)),c.render(r.default.createElement(a.Provider,{store:d},r.default.createElement(A,{isOpen:n,onInsert:function(){return o.handleInsert(...arguments)},onClosed:()=>this.close(),title:e.default._t("CMS.LINK_ANCHOR","Link to an anchor on a page"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--anchor",fileAttributes:l,identifier:"Admin.InsertLinkAnchorModal",requireLinkText:s,currentPageID:u})))},buildAttributes(e){return{href:`${d.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(){const e=this.getElement().getEditor(),n=t(e.getSelectedNode()),r=(n.attr("href")||"").split("#");if(!r[0])return{};const i=d.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(p,(e=>f.init(e)))}()}(); \ No newline at end of file diff --git a/client/dist/js/TinyMCE_sslink-internal.js b/client/dist/js/TinyMCE_sslink-internal.js index 7c345556b4..55c9066f40 100644 --- a/client/dist/js/TinyMCE_sslink-internal.js +++ b/client/dist/js/TinyMCE_sslink-internal.js @@ -1 +1 @@ -!function(){"use strict";var t={207:function(t){t.exports=Injector},127:function(t){t.exports=InsertLinkModal},594:function(t){t.exports=React},145:function(t){t.exports=ReactDomClient},40:function(t){t.exports=ReactRedux},502:function(t){t.exports=ShortcodeSerialiser},153:function(t){t.exports=TinyMCEActionRegistrar},815:function(t){t.exports=i18n},669: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=c(n(815)),e=c(n(153)),i=c(n(594)),r=n(145),o=n(40),a=c(n(669)),s=c(n(502)),l=n(127),d=n(207);function c(t){return t&&t.__esModule?t:{default:t}}const u="sslinkinternal",p={init(n){e.default.addAction("sslink",{text:t.default._t("CMS.LINKLABEL_PAGE","Page on this site"),onAction:t=>t.execCommand(u),priority:90},n.getParam("editorIdentifier")).addCommandWithUrlTest(u,/^\[sitetree_link.+]$/),n.addCommand(u,(()=>{(0,a.default)(`#${n.id}`).entwine("ss").openLinkInternalDialog()}))}},f="insert-link__dialog-wrapper--internal",g=(0,d.provideInjector)((0,l.createInsertLinkModal)("SilverStripe\\CMS\\Controllers\\CMSPageEditController","editorInternalLink"));a.default.entwine("ss",(e=>{e("textarea.htmleditor").entwine({openLinkInternalDialog(){let t=e(`#${f}`);t.length||(t=e(`
`),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 a=ss.store,s=this.getOriginalAttributes(),l=this.getRequireLinkText();let d=this.getReactRoot();d||(d=(0,r.createRoot)(this[0]),this.setReactRoot(d)),d.render(i.default.createElement(o.Provider,{store:a},i.default.createElement(g,{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:s,identifier:"Admin.InsertLinkInternalModal",requireLinkText:l})))},buildAttributes(t){return{href:`${s.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=s.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(u,(t=>p.init(t)))}()}(); \ No newline at end of file +!function(){"use strict";var t={207:function(t){t.exports=Injector},127:function(t){t.exports=InsertLinkModal},594:function(t){t.exports=React},145:function(t){t.exports=ReactDomClient},40:function(t){t.exports=ReactRedux},502:function(t){t.exports=ShortcodeSerialiser},153:function(t){t.exports=TinyMCEActionRegistrar},815:function(t){t.exports=i18n},669: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=c(n(815)),e=c(n(153)),i=c(n(594)),r=n(145),o=n(40),a=c(n(669)),s=c(n(502)),l=n(127),d=n(207);function c(t){return t&&t.__esModule?t:{default:t}}const u="sslinkinternal",p={init(n){e.default.addAction("sslink",{text:t.default._t("CMS.LINKLABEL_PAGE","Page on this site"),onAction:t=>t.execCommand(u),priority:90},n.getParam("editorIdentifier")).addCommandWithUrlTest(u,/^\[sitetree_link.+]$/),n.addCommand(u,(()=>{(0,a.default)(`#${n.id}`).entwine("ss").openLinkInternalDialog()}))}},f="insert-link__dialog-wrapper--internal",g=(0,d.provideInjector)((0,l.createInsertLinkModal)("SilverStripe\\Admin\\LeftAndMain","editorInternalLink"));a.default.entwine("ss",(e=>{e("textarea.htmleditor").entwine({openLinkInternalDialog(){let t=e(`#${f}`);t.length||(t=e(`
`),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 a=ss.store,s=this.getOriginalAttributes(),l=this.getRequireLinkText();let d=this.getReactRoot();d||(d=(0,r.createRoot)(this[0]),this.setReactRoot(d)),d.render(i.default.createElement(o.Provider,{store:a},i.default.createElement(g,{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:s,identifier:"Admin.InsertLinkInternalModal",requireLinkText:l})))},buildAttributes(t){return{href:`${s.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=s.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(u,(t=>p.init(t)))}()}(); \ No newline at end of file diff --git a/client/src/legacy/TinyMCE_sslink-anchor.js b/client/src/legacy/TinyMCE_sslink-anchor.js index a415666ed9..7eae3a7ade 100644 --- a/client/src/legacy/TinyMCE_sslink-anchor.js +++ b/client/src/legacy/TinyMCE_sslink-anchor.js @@ -44,7 +44,7 @@ const plugin = { }; const modalId = 'insert-link__dialog-wrapper--anchor'; -const sectionConfigKey = 'SilverStripe\\CMS\\Controllers\\CMSPageEditController'; +const sectionConfigKey = 'SilverStripe\\Admin\\LeftAndMain'; const formName = 'editorAnchorLink'; const InsertLinkInternalModal = provideInjector(createInsertLinkModal(sectionConfigKey, formName)); diff --git a/client/src/legacy/TinyMCE_sslink-internal.js b/client/src/legacy/TinyMCE_sslink-internal.js index 2b4887ba44..182755c683 100644 --- a/client/src/legacy/TinyMCE_sslink-internal.js +++ b/client/src/legacy/TinyMCE_sslink-internal.js @@ -36,7 +36,7 @@ const plugin = { }; const modalId = 'insert-link__dialog-wrapper--internal'; -const sectionConfigKey = 'SilverStripe\\CMS\\Controllers\\CMSPageEditController'; +const sectionConfigKey = 'SilverStripe\\Admin\\LeftAndMain'; const formName = 'editorInternalLink'; const InsertLinkInternalModal = provideInjector(createInsertLinkModal(sectionConfigKey, formName)); diff --git a/code/Controllers/CMSPageEditController.php b/code/Controllers/CMSPageEditController.php index 2573f70678..46526b1975 100644 --- a/code/Controllers/CMSPageEditController.php +++ b/code/Controllers/CMSPageEditController.php @@ -4,7 +4,6 @@ use Page; use SilverStripe\Admin\LeftAndMain; -use SilverStripe\Admin\ModalController; use SilverStripe\CampaignAdmin\AddToCampaignHandler; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\Controller; @@ -37,18 +36,11 @@ class CMSPageEditController extends CMSMain public function getClientConfig(): array { - $modalController = ModalController::singleton(); return ArrayLib::array_merge_recursive(parent::getClientConfig(), [ 'form' => [ 'AddToCampaignForm' => [ 'schemaUrl' => $this->Link('schema/AddToCampaignForm'), ], - 'editorInternalLink' => [ - 'schemaUrl' => $modalController->Link('schema/editorInternalLink'), - ], - 'editorAnchorLink' => [ - 'schemaUrl' => $modalController->Link('schema/editorAnchorLink/:pageid'), - ], ], ]); } diff --git a/code/Forms/AnchorLinkFormFactory.php b/code/Forms/AnchorLinkFormFactory.php index 19e9dea82a..45179dc703 100644 --- a/code/Forms/AnchorLinkFormFactory.php +++ b/code/Forms/AnchorLinkFormFactory.php @@ -10,7 +10,7 @@ protected function getFormFields($controller, $name, $context) // Ensure current page is selected $pageIDField = $fields->dataFieldByName('PageID'); - $pageIDField->setValue((int)$context['PageID']); + $pageIDField->setValue((int)$context['ItemID']); // Get anchor selector field $fields->insertAfter( @@ -22,6 +22,6 @@ protected function getFormFields($controller, $name, $context) public function getRequiredContext() { - return array_merge(parent::getRequiredContext(), [ 'PageID' ]); + return array_merge(parent::getRequiredContext(), [ 'ItemID' ]); } } diff --git a/code/Forms/InternalLinkModalExtension.php b/code/Forms/InternalLinkModalExtension.php deleted file mode 100644 index 674641e2c2..0000000000 --- a/code/Forms/InternalLinkModalExtension.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @deprecated 5.4.0 Will be replaced with configuration on SilverStripe\Admin\ModalController - */ -class InternalLinkModalExtension extends Extension -{ - private static $url_handlers = [ - 'editorAnchorLink/$ItemID' => 'editorAnchorLink', // Matches FormSchemaController::schema args - ]; - - private static $allowed_actions = [ - 'editorInternalLink', - 'editorAnchorLink', - ]; - - public function __construct() - { - Deprecation::noticeWithNoReplacment( - '5.4.0', - 'Will be replaced with configuration on ' . ModalController::class, - Deprecation::SCOPE_CLASS - ); - } - - /** - * Form for inserting internal link pages - * - * @return Form - */ - public function editorInternalLink() - { - $showLinkText = $this->getOwner()->getRequest()->getVar('requireLinkText'); - $factory = InternalLinkFormFactory::singleton(); - return $factory->getForm( - $this->getOwner(), - "editorInternalLink", - [ 'RequireLinkText' => isset($showLinkText) ] - ); - } - - public function editorAnchorLink() - { - // Note: Should work both via schema() and as direct request - $request = $this->getOwner()->getRequest(); - $showLinkText = $request->getVar('requireLinkText'); - $pageID = $request->param('ItemID'); - $factory = AnchorLinkFormFactory::singleton(); - $form = $factory->getForm( - $this->getOwner(), - "editorAnchorLink", - [ 'RequireLinkText' => isset($showLinkText), 'PageID' => $pageID ] - ); - - // Set url handler that includes pageID - $form->setRequestHandler( - LeftAndMainFormRequestHandler::create($form, [$pageID]) - ); - - return $form; - } -} diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature index d0eb707943..960967622e 100644 --- a/tests/behat/features/insert-a-link.feature +++ b/tests/behat/features/insert-a-link.feature @@ -22,8 +22,8 @@ So that I can link to a external website or a page on my site When I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Page on this site" in the ".tox-collection__group" element - Then I should see an "form#Form_editorInternalLink" element - When I select "About Us" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown + Then I should see an "form#Form_linkModalFormeditorInternalLink" element + When I select "About Us" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder" tree dropdown And I fill in "my desc" for "Link description" And I press the "Insert link" button Then the "Content" HTML field should contain "awesome" @@ -36,9 +36,9 @@ So that I can link to a external website or a page on my site When I select the image "file1.jpg" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Page on this site" in the ".tox-collection__group" element - Then I should see an "form#Form_editorInternalLink" element + Then I should see an "form#Form_linkModalFormeditorInternalLink" element And I should not see "Link text" - When I select "About Us" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown + When I select "About Us" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder" tree dropdown And I press the "Insert link" button Then the "Content" HTML field should contain "" # Required to avoid "unsaved changes" browser dialog @@ -50,11 +50,11 @@ So that I can link to a external website or a page on my site And I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Page on this site" in the ".tox-collection__group" element - And I should see an "form#Form_editorInternalLink" element - Then I should see "About Us" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__value-container" element + And I should see an "form#Form_linkModalFormeditorInternalLink" element + Then I should see "About Us" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__value-container" element And the "Link description" field should contain "my desc" # This doesn't seem to suffer from that issue - When I select "Home" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown + When I select "Home" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder" tree dropdown And I fill in "my new desc" for "Link description" And I press the "Insert link" button Then the "Content" HTML field should contain "awesome" @@ -66,7 +66,7 @@ So that I can link to a external website or a page on my site Given I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button When I click "Link to external URL" in the ".tox-collection__group" element - And I should see an "form#Form_EditorExternalLink" element + And I should see an "form#Form_linkModalFormEditorExternalLink" element When I fill in "http://silverstripe.org" for "URL" And I check "Open in new window/tab" And I press the "Insert link" button @@ -80,7 +80,7 @@ So that I can link to a external website or a page on my site When I select the image "file1.jpg" in the "Content" HTML field And I press the "Insert link" HTML field button When I click "Link to external URL" in the ".tox-collection__group" element - And I should see an "form#Form_EditorExternalLink" element + And I should see an "form#Form_linkModalFormEditorExternalLink" element And I should not see "Link text" When I fill in "http://silverstripe.org" for "URL" And I press the "Insert link" button @@ -94,7 +94,7 @@ So that I can link to a external website or a page on my site And I select "awesome" in the "Content" HTML field When I press the "Insert link" HTML field button And I click "Link to external URL" in the ".tox-collection__group" element - And I should see an "form#Form_EditorExternalLink" element + And I should see an "form#Form_linkModalFormEditorExternalLink" element Then the "URL" field should contain "http://silverstripe.org" # This doesn't seem to suffer from that issue When I fill in "http://google.com" for "URL" @@ -118,17 +118,17 @@ So that I can link to a external website or a page on my site When I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Page on this site" in the ".tox-collection__group" element - Then I should see an "form#Form_editorInternalLink" element - When I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__value-container" element - Then I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-button" element - And I should not see "Page 1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element - And I should see "Page 1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element - Then I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-button" element - And I should not see "Page 1.1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element - And I should see "Page 1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element - Then I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-button" element - And I should see "Page 1.1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element - When I select "Page 1.1.1.1" in the "#Form_editorInternalLink_PageID_Holder" tree dropdown + Then I should see an "form#Form_linkModalFormeditorInternalLink" element + When I click on the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__value-container" element + Then I click on the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-button" element + And I should not see "Page 1.1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-title" element + And I should see "Page 1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-title" element + Then I click on the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-button" element + And I should not see "Page 1.1.1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-title" element + And I should see "Page 1.1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-title" element + Then I click on the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-button" element + And I should see "Page 1.1.1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-title" element + When I select "Page 1.1.1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder" tree dropdown And I fill in "my new desc" for "Link description" And I press the "Insert link" button Then I press the "Save" button @@ -137,20 +137,20 @@ So that I can link to a external website or a page on my site When I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Page on this site" in the ".tox-collection__group" element - Then I should see an "form#Form_editorInternalLink" element - When I click on the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__value-container" element + Then I should see an "form#Form_linkModalFormeditorInternalLink" element + When I click on the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__value-container" element And I press the "Down" key globally And I press the "Down" key globally And I press the "Down" key globally And I press the "Right" key globally - Then I should see "Page 1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + Then I should see "Page 1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-title" element And I press the "Down" key globally And I press the "Right" key globally - Then I should see "Page 1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element + Then I should see "Page 1.1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-title" element And I press the "Down" key globally And I press the "Right" key globally - Then I should see "Page 1.1.1.1" in the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-title" element - And I should not see the "#Form_editorInternalLink_PageID_Holder .treedropdownfield__option-button" element + Then I should see "Page 1.1.1.1" in the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-title" element + And I should not see the "#Form_linkModalFormeditorInternalLink_PageID_Holder .treedropdownfield__option-button" element And I press the "Enter" key globally And I fill in "my new desc" for "Link description" And I press the "Insert link" button diff --git a/tests/behat/features/insert-anchor-link.feature b/tests/behat/features/insert-anchor-link.feature index 29aebf1983..931405f2f7 100644 --- a/tests/behat/features/insert-anchor-link.feature +++ b/tests/behat/features/insert-anchor-link.feature @@ -18,11 +18,11 @@ So that I can link to a external website or a page on my site When I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Anchor on a page" in the ".tox-collection__group" element - Then I should see an "form#Form_editorAnchorLink" element - And I should see "About Us" in the "#Form_editorAnchorLink_PageID_Holder .treedropdownfield__value-container" element - When I select "Details" in the "#Form_editorAnchorLink_PageID_Holder" tree dropdown - And I select "youranchor" in the "#Form_editorAnchorLink_Anchor_Holder" anchor dropdown - Then I should see "youranchor" in the "#Form_editorAnchorLink_Anchor_Holder .anchorselectorfield__value-container" element + Then I should see an "form#Form_linkModalFormeditorAnchorLink" element + And I should see "About Us" in the "#Form_linkModalFormeditorAnchorLink_PageID_Holder .treedropdownfield__value-container" element + When I select "Details" in the "#Form_linkModalFormeditorAnchorLink_PageID_Holder" tree dropdown + And I select "youranchor" in the "#Form_linkModalFormeditorAnchorLink_Anchor_Holder" anchor dropdown + Then I should see "youranchor" in the "#Form_linkModalFormeditorAnchorLink_Anchor_Holder .anchorselectorfield__value-container" element When I fill in "my desc" for "Link description" And I press the "Insert link" button Then the "Content" HTML field should contain "awesome" @@ -35,11 +35,11 @@ So that I can link to a external website or a page on my site When I select the image "file1.jpg" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Anchor on a page" in the ".tox-collection__group" element - Then I should see an "form#Form_editorAnchorLink" element + Then I should see an "form#Form_linkModalFormeditorAnchorLink" element And I should not see "Link text" - And I should see "About Us" in the "#Form_editorAnchorLink_PageID_Holder .treedropdownfield__value-container" element - When I select "Details" in the "#Form_editorAnchorLink_PageID_Holder" tree dropdown - And I select "youranchor" in the "#Form_editorAnchorLink_Anchor_Holder" anchor dropdown + And I should see "About Us" in the "#Form_linkModalFormeditorAnchorLink_PageID_Holder .treedropdownfield__value-container" element + When I select "Details" in the "#Form_linkModalFormeditorAnchorLink_PageID_Holder" tree dropdown + And I select "youranchor" in the "#Form_linkModalFormeditorAnchorLink_Anchor_Holder" anchor dropdown And I press the "Insert link" button Then the "Content" HTML field should contain "" # Required to avoid "unsaved changes" browser dialog @@ -50,10 +50,10 @@ So that I can link to a external website or a page on my site When I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Anchor on a page" in the ".tox-collection__group" element - Then I should see an "form#Form_editorAnchorLink" element - And I should see "About Us" in the "#Form_editorAnchorLink_PageID_Holder .treedropdownfield__value-container" element - When I select "dataobject-anchor" in the "#Form_editorAnchorLink_Anchor_Holder" anchor dropdown - Then I should see "dataobject-anchor" in the "#Form_editorAnchorLink_Anchor_Holder .anchorselectorfield__value-container" element + Then I should see an "form#Form_linkModalFormeditorAnchorLink" element + And I should see "About Us" in the "#Form_linkModalFormeditorAnchorLink_PageID_Holder .treedropdownfield__value-container" element + When I select "dataobject-anchor" in the "#Form_linkModalFormeditorAnchorLink_Anchor_Holder" anchor dropdown + Then I should see "dataobject-anchor" in the "#Form_linkModalFormeditorAnchorLink_Anchor_Holder .anchorselectorfield__value-container" element When I fill in "my desc" for "Link description" And I press the "Insert link" button Then the "Content" HTML field should contain "awesome" @@ -66,12 +66,12 @@ So that I can link to a external website or a page on my site When I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button And I click "Anchor on a page" in the ".tox-collection__group" element - Then I should see an "form#Form_editorAnchorLink" element - And I should see "About Us" in the "#Form_editorAnchorLink_PageID_Holder .treedropdownfield__value-container" element + Then I should see an "form#Form_linkModalFormeditorAnchorLink" element + And I should see "About Us" in the "#Form_linkModalFormeditorAnchorLink_PageID_Holder .treedropdownfield__value-container" element When I click on the ".anchorselectorfield__dropdown-indicator" element Then I should see "dataobject-anchor" in the ".anchorselectorfield__menu-list" element - When I select "unsaved-anchor" in the "#Form_editorAnchorLink_Anchor_Holder" anchor dropdown - Then I should see "unsaved-anchor" in the "#Form_editorAnchorLink_Anchor_Holder .anchorselectorfield__value-container" element + When I select "unsaved-anchor" in the "#Form_linkModalFormeditorAnchorLink_Anchor_Holder" anchor dropdown + Then I should see "unsaved-anchor" in the "#Form_linkModalFormeditorAnchorLink_Anchor_Holder .anchorselectorfield__value-container" element When I fill in "my desc" for "Link description" And I press the "Insert link" button Then the "Content" HTML field should contain "awesome"