Opened 8 years ago
Closed 6 years ago
#38628 closed defect (bug) (maybelater)
Pasting an image URL inside for a shortcode unexpectedly displays the image
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | TinyMCE | Keywords: | needs-patch |
Focuses: | Cc: |
Description
Given a shortcode in the TinyMCE like:
[image url=""]
When I paste an image URL http://example.org/image.jpg
inside of the url=""
attribute, I'd expect to see:
[image url="http://example.org/image.jpg"]
Instead, I see the image URL expanded to its visual representation.
It seems like smartInsertContent()
should be disabled when the selection is inside of a shortcode.
Change History (7)
#2
@
8 years ago
This is new functionality in TinyMCE 4.4. It has a "two steps undo" that can be used here: first to the pasted URL, second to removing the pasted content completely. So pressing Ctrl/Cmd + Z will revert it to the pasted URL.
We can try using the 'PastePreProcess'
event to look for image URLs and prevent the conversion, but for that we will need to be able to properly detect when the user is typing in a shortcode. This will be pretty hard to do in core as we don't know about any registered shortcodes. Then we will have to detect things like partial shortcodes, while the user is typing and the closing ]
is not there yet. Also perhaps URLs wrapped in shortcodes... This gets quite complex and error prone fast.
Another option is to disable the conversion to image tag on pasting an image URL. However this is a nice small feature, don't think we should remove it just because of this edge case. Thinking best/most logical is to let the users discover and use the two step undo as pasting image URL in a shortcode attribute is quite rare.
This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.
8 years ago
#4
follow-up:
↓ 5
@
8 years ago
- Milestone changed from Awaiting Review to Future Release
I suggest we make this work like auto embedding and only allow it on an empty line. I don't see why it should create an image in the middle of any text. How does that sound?
@iseulde @azaozz Any thoughts on how
insertImage
could be disabled temporarily (as a one-off for a specific WordPress install) in this use case?