NPM Resource Changed ? ? ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
4 May 2020

Pull Request for Issue #27477 .

Summary of Changes

Restores Drag and Drop images functionality for tinyMCE

Some remarks:

  • This solves the Release Blocker issue
  • There is a hardcoded part (there is a todo in the code) which is the same issue as #26750, which is also a Release Blocker
  • There is no more a progress indicator, this is due to the lack of information to implement such functionality
  • This PR is also adding the lading=lazy attribute

Testing Instructions

Apply the patch run npm ci and try to drag an image into tinyMCE's edit area

Expected result

Actual result

Documentation Changes Required

No, it's a bug fix.

avatar dgrammatiko dgrammatiko - open - 4 May 2020
avatar dgrammatiko dgrammatiko - change - 4 May 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 May 2020
Category Front End Plugins
avatar dgrammatiko dgrammatiko - change - 4 May 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 4 May 2020
Category Front End Plugins JavaScript Repository NPM Change Front End Plugins
4d6221e 4 May 2020 avatar dgrammatiko woof
avatar dgrammatiko dgrammatiko - change - 4 May 2020
Labels Added: NPM Resource Changed
avatar dgrammatiko dgrammatiko - change - 4 May 2020
The description was changed
avatar dgrammatiko dgrammatiko - edited - 4 May 2020
avatar dgrammatiko dgrammatiko - change - 4 May 2020
The description was changed
avatar dgrammatiko dgrammatiko - edited - 4 May 2020
avatar Fedik
Fedik - comment - 4 May 2020

you can drop jdragndrop and use TinyMCE image upload,

I tried something with custom images_upload_handler, but due to new media manager limitation, it not finished 4.0-dev...Fedik:image-drop , you can use that as a hint, if you like.

avatar dgrammatiko
dgrammatiko - comment - 4 May 2020

@Fedik the reason we didn't use the build in tinyMCE uploader was that it didn't support custom names (eg the name of the file for upload) back in version 4.0. I guess if this is changed in v5 (I'll have to check) then we can use it

avatar brianteeman
brianteeman - comment - 4 May 2020

Setting images_reuse_filename to true tells TinyMCE to use the actual filename of the image, instead of generating a new one each time.

avatar dgrammatiko
dgrammatiko - comment - 4 May 2020

Reading their docs this might be a limitation:
Screenshot 2020-05-04 at 16 47 17

Anyways I can try to see if I can use their handler later today

avatar Fedik
Fedik - comment - 4 May 2020

Reading their docs this might be a limitation

images_upload_handler option can help to break through this limitation ?
you are free to copy Joomla.JoomlaTinyMCE.uploadHandler from my unfinished branch.

Nothing much critical, but would be good to use tinymce features, when it possible,
it also can display upload errors to user etc

avatar dgrammatiko
dgrammatiko - comment - 4 May 2020

So, using the tinyMCE's own handler is not that hard but there are some differences:

Screenshot 2020-05-04 at 19 10 37

@Fedik if you want to play around with this the code is here: https://gist.github.com/dgrammatiko/1ffc213290914024817a106fc9f5f89c

avatar Fedik
Fedik - comment - 4 May 2020

But the worse is that there are instances that the file(s) might be inlined

hm, I see, that not very good

upd. well then, leave the plugin ?

avatar richard67
richard67 - comment - 6 May 2020

Adding the "Release Blocker" label since inherited from issue #27477 .

avatar dgrammatiko dgrammatiko - change - 6 May 2020
Labels Added: ?
avatar richard67 richard67 - change - 6 May 2020
The description was changed
avatar richard67 richard67 - edited - 6 May 2020
avatar chmst
chmst - comment - 16 May 2020

The image can be imported into the image folder via drag and drop. It is stored in images.

But the result in the artice is:
<p><img src="../images/xx.jpg" loading="lazy" /></p>

The alt="" is missing which is important for a11y
and the image is in src="images/ ... " not in "../images..."

avatar dgrammatiko
dgrammatiko - comment - 16 May 2020

But the result in the artice is: <p><img src="../images/xx.jpg" loading="lazy" /></p>

That's weird because the code is hardcoding to / as the first character:

https://github.com/joomla/joomla-cms/pull/28928/files#diff-3190d9429a056012da019775e53ad156R58

The alt="" is missing which is important for a11y

You can add it by clicking on the tinyMCE's image icon. By dropping an image we don't have any data to fill that attribute ;)

avatar SharkyKZ
SharkyKZ - comment - 16 May 2020

Why is leading slash used here?

avatar dgrammatiko
dgrammatiko - comment - 16 May 2020

Why is leading slash used here?

Essentially the code is copy paste from here:

Joomla.doIt = (resp, editor, fieldClass) => {
if (resp.success === true) {
if (resp.data[0].url) {
if (/local-/.test(resp.data[0].adapter)) {
const { rootFull } = Joomla.getOptions('system.paths');
// eslint-disable-next-line prefer-destructuring
Joomla.selectedFile.url = resp.data[0].url.split(rootFull)[1];
if (resp.data[0].thumb_path) {
Joomla.selectedFile.thumb = resp.data[0].thumb_path;
} else {
Joomla.selectedFile.thumb = false;
}
} else if (resp.data[0].thumb_path) {
Joomla.selectedFile.thumb = resp.data[0].thumb_path;
}
} else {
Joomla.selectedFile.url = false;
}

Shouldn't the url start with a backslash?

PS maybe there were couple of mistakes there, updated to reflect the media field code

avatar chmst
chmst - comment - 16 May 2020

You can add it by clicking on the tinyMCE's image icon. By dropping an image we don't have any data to fill that attribute ;)

alt="" is all right. Then a screenreader reads nothing. If there is no alt alt all, the screenreader reads the filename - and every validation tool reports an error.

avatar dgrammatiko
dgrammatiko - comment - 16 May 2020

alt="" is all right

Empty alt attribute was added

avatar SharkyKZ
SharkyKZ - comment - 16 May 2020

Doesn't work. Getting this now:

TypeError: response.data.url is undefined plugin.js:58:13

avatar dgrammatiko
dgrammatiko - comment - 16 May 2020

@SharkyKZ should be fine now

avatar chmst chmst - test_item - 16 May 2020 - Tested successfully
avatar chmst
chmst - comment - 16 May 2020

I have tested this item successfully on 2024b22

Works!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28928.

avatar alikon alikon - test_item - 17 May 2020 - Tested successfully
avatar alikon
alikon - comment - 17 May 2020

I have tested this item successfully on 2024b22


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28928.

avatar alikon alikon - change - 17 May 2020
Status Pending Ready to Commit
avatar alikon
alikon - comment - 17 May 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28928.

avatar zero-24
zero-24 - comment - 23 May 2020

Merging thanks. ?

avatar zero-24 zero-24 - close - 23 May 2020
avatar zero-24 zero-24 - merge - 23 May 2020
avatar zero-24 zero-24 - change - 23 May 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-05-23 22:22:01
Closed_By zero-24
Labels Added: ?

Add a Comment

Login with GitHub to post a comment