Skip to content

Commit

Permalink
Merge branch '2' into 3
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 27, 2024
2 parents 1c18c90 + 1968e3f commit 67c5d86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_sslink.js

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

9 changes: 8 additions & 1 deletion client/src/legacy/TinyMCE_sslink.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const plugin = {

// Callback for opening the edit link dialog form
function openLinkDialog() {
// Find "a" node (we might have clicked on a child element e.g. "span")
const linkNode = jQuery(tinymce.activeEditor.selection.getNode()).closest('a');
tinymce.activeEditor.selection.select(linkNode[0]);
const node = tinymce.activeEditor.selection.getNode();
const href = node.getAttribute('href');

Expand Down Expand Up @@ -192,7 +195,11 @@ jQuery.entwine('ss', ($) => {
*/
getRequireLinkText() {
const editor = this.getElement().getEditor();
const selection = editor.getInstance().selection;
let selection = editor.getInstance().selection;
const node = $(selection.getNode()).closest('a');
editor.getInstance().selection.select(node[0]);

selection = editor.getInstance().selection;
const isValidSelection = this.linkCanWrapSelection(editor, selection);
const tagName = selection.getNode().tagName;
const requireLinkText = tagName !== 'A' && !isValidSelection;
Expand Down

0 comments on commit 67c5d86

Please sign in to comment.