Skip to content

Commit

Permalink
[BUGFIX] Fixes #186: Inline image with link sometimes causes incorrec…
Browse files Browse the repository at this point in the history
…t ordering of double
  • Loading branch information
magicsunday committed Aug 10, 2023
1 parent 9fb0b0e commit 3614fc2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Resources/Public/JavaScript/Plugins/typo3image.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
init: function (editor) {
require(['jquery'], function (jquery) {
$ = jquery;

var allowedAttributes = ['!src', 'alt', 'title', 'class', 'rel', 'width', 'height'],
additionalAttributes = getAdditionalAttributes(editor),
$shadowEditor = $('<div>').append(editor.element.$.innerText),
Expand All @@ -33,7 +32,7 @@
editor.toolbar.forEach(function(toolbar){
if(toolbar.items){
toolbar.items.forEach(function(item){
if(item.command == 'image'){
if(item.command === 'image'){
item.setState(CKEDITOR.TRISTATE_OFF)
}
});
Expand Down Expand Up @@ -173,10 +172,17 @@
// Open our and not the CKEditor image dialog on double click:
editor.on('doubleclick', function(evt) {
if (evt.data.dialog === 'image') {
evt.stop();
delete evt.data.dialog;
}

var current = evt.data.element;
if (!evt.data.dialog && current && current.is('img') && current.getAttribute('data-htmlarea-file-uid')) {

if (!evt.data.dialog
&& current
&& current.is('img')
&& current.getAttribute('data-htmlarea-file-uid')
) {
edit(
current.getAttribute('data-htmlarea-file-table') || 'sys_file',
current.getAttribute('data-htmlarea-file-uid'),
Expand Down Expand Up @@ -212,7 +218,7 @@
});

/**
*
*
* @returns value
*/
function getTitleText() {
Expand All @@ -225,7 +231,7 @@
}

/**
*
*
* @param url
* @return relativeUrl
*/
Expand All @@ -245,7 +251,7 @@
return "/" + url;
}
}

return url;
}

Expand Down

0 comments on commit 3614fc2

Please sign in to comment.