Skip to content

Commit

Permalink
FIX Allow wrapping an image in a link (#2883)
Browse files Browse the repository at this point in the history
Relies on logic added to silverstripe/admin, so we need to bump the
constraint as well.

Behat test requires new logic added to the behat-extension module.
  • Loading branch information
GuySartorelli authored Sep 6, 2023
1 parent 90e3099 commit ba578cf
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 26 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_sslink-anchor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_sslink-internal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions client/src/legacy/TinyMCE_sslink-anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ jQuery.entwine('ss', ($) => {
const handleHide = () => this.close();
const handleInsert = (...args) => this.handleInsert(...args);
const attrs = this.getOriginalAttributes();
const selection = tinymce.activeEditor.selection;
const selectionContent = selection.getContent() || '';
const tagName = selection.getNode().tagName;
const requireLinkText = tagName !== 'A' && selectionContent.trim() === '';
const requireLinkText = this.getRequireLinkText();
const currentPageID = Number($('#Form_EditForm_ID').val() || 0);

// create/update the react component
Expand Down
14 changes: 0 additions & 14 deletions client/src/legacy/TinyMCE_sslink-internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,6 @@ jQuery.entwine('ss', ($) => {
);
},

/**
* Determine whether to show the link text field
*
* @return {Boolean}
*/
getRequireLinkText() {
const selection = this.getElement().getEditor().getInstance().selection;
const selectionContent = selection.getContent() || '';
const tagName = selection.getNode().tagName;
const requireLinkText = tagName !== 'A' && selectionContent.trim() === '';

return requireLinkText;
},

/**
* @param {Object} data - Posted data
* @return {Object}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"require": {
"silverstripe/admin": "^1.12@dev",
"silverstripe/admin": "^1.13@dev",
"silverstripe/campaign-admin": "^1.7@dev",
"silverstripe/framework": "^4.11",
"silverstripe/reports": "^4.7@dev",
Expand Down Expand Up @@ -55,4 +55,4 @@
},
"prefer-stable": true,
"minimum-stability": "dev"
}
}
Loading

0 comments on commit ba578cf

Please sign in to comment.