WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#31464 closed enhancement (fixed)

MCE Views - Don't restrict importing of styles to AV views.

Reported by: mattheu Owned by: azaozz
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.0
Component: TinyMCE Keywords: has-patch
Focuses: javascript Cc:

Description (last modified by SergeyBiryukov)

FIrstly - some great improvements to the MCE view code recently - see #31412.

I would like to register a custom view which is sometimes sandboxed in an iFrame. I would also like to have the styles imported from the editor.

However this is hardcoded to only do this for video, audio and playlists.

importStyles = this.type === 'video' || this.type === 'audio' || this.type === 'playlist';

I think this should be a property on the view object - set to false by default but true for the AV views. This would allow me to easily enable it for my views.

Patch incomming.

Attachments (6)

31464.diff (1.9 KB) - added by mattheu 5 years ago.
31464.2.diff (2.3 KB) - added by mattheu 5 years ago.
31464.patch (3.1 KB) - added by iseulde 5 years ago.
31464.2.patch (2.7 KB) - added by iseulde 5 years ago.
31464.3.patch (3.0 KB) - added by iseulde 5 years ago.
31464.4.patch (2.4 KB) - added by iseulde 5 years ago.

Download all attachments as: .zip

Change History (24)

@mattheu
5 years ago

#1 @iseulde
5 years ago

Yep, we should rework that too.

#2 @iseulde
5 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.2

#3 @SergeyBiryukov
5 years ago

  • Description modified (diff)

#4 @iseulde
5 years ago

Not sure if there's any reason to not do this all the time.

@mattheu
5 years ago

#5 @mattheu
5 years ago

Not sure if there's any reason to not do this all the time.

Agreed - I think thats pretty much the point of the sandbox functionality.

Attached an updated patch.

#6 @iseulde
5 years ago

  • Component changed from General to TinyMCE

This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.


5 years ago

@iseulde
5 years ago

#8 @iseulde
5 years ago

Refreshed your patch and made the cache private.

@iseulde
5 years ago

@iseulde
5 years ago

#9 @iseulde
5 years ago

  • Version changed from trunk to 4.0

#10 @mattheu
5 years ago

I wonder if styles should only be imported in setIframes if head is null?

#11 @iseulde
5 years ago

I'll investigate this a bit more. I think there are a few problems with these styles in general.

This ticket was mentioned in Slack in #core-editor by azaozz. View the logs.


5 years ago

This ticket was mentioned in Slack in #core by johnbillion. View the logs.


5 years ago

#14 @DrewAPicture
5 years ago

  • Milestone changed from 4.2 to Future Release

Unfortunately this just didn't get done in time for 4.2. Let's try again in 4.3.

@iseulde
5 years ago

#15 @iseulde
5 years ago

  • Milestone changed from Future Release to 4.2

Refreshed the patch. We can refine which styles get added later and see if there are any problems. This is for audio and video too, because some styles don't seem to be added.

This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.


5 years ago

#17 @azaozz
5 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 31742:

TinyMCE wpViews: always import the non-default editor styles in the sandbox iframe in views.
Props iseulde, mattheu. Fixes #31464.

#18 @azaozz
5 years ago

In 31757:

TinyMCE wpViews: fix typos in the conditional checking which stylesheets to import.
Props mattheu. See #31464.

Note: See TracTickets for help on using tickets.