[wp-trac] [WordPress Trac] #31412: TinyMCE views improvements

WordPress Trac noreply at wordpress.org
Thu Feb 26 11:10:47 UTC 2015


#31412: TinyMCE views improvements
-------------------------+-------------------------
 Reporter:  iseulde      |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  4.2
Component:  TinyMCE      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  javascript
-------------------------+-------------------------
Description changed by iseulde:

Old description:

> I'm going to use this ticket to propose some improvements to the mce
> views API, instead of adding this to #29841.
>
> * Give views the option to display a loader or not. See #29841. We can
> mark the paragraph and replace it later based on this option. To the user
> it will look as if nothing happened until there is a match. This is very
> useful for oEmbed.
> * Remove the `wrap` and `replace` options from `setContent`.
> * Better edit function. Now it's part of the instance, so no need to look
> at the node for the encoded text. You can call the function provided to
> refresh the view, no need to touch the DOM any more. You can see the edit
> functions of the core views are a lot simpler.
> * The gallery and av views now reuse the same edit function.
> * Simpler registration.
> * `setContent` will call `setIframes` itself if needed.
> * Selecting another view will pause all players. We could also limit this
> to the same view type or a set of view types. This allows us to remove a
> lot of code.
> * Better documentation (though it could be better still).
> * Move the main API to the top of the file.
> * Wrap the view registration in a separate IIFE. Ideally this should go
> in a separate file.
> * The `render` method is easier to override.
> * Better detection of already rendered views, so we don't unnecessarily
> refresh views.
> * I added a proper `setLoader` method, just like `setError`.
> * All options set in `toView` are now added as properties of the
> instance.
>
> The most vital stuff is backward compatible. I will do some more testing.
> Suggestion are welcome.

New description:

 I'm going to use this ticket to propose some improvements to the mce views
 API, instead of adding this to #29841.

 * Give views the option to display a loader or not. See #29841. We can
 mark the paragraph and replace it later based on this option. To the user
 it will look as if nothing happened until there is a match. This is very
 useful for oEmbed.
 * Remove the `wrap` and `replace` options from `setContent`.
 * Better edit function. Now it's part of the instance, so no need to look
 at the node for the encoded text. You can call the function provided to
 refresh the view, no need to touch the DOM any more. You can see the edit
 functions of the core views are a lot simpler.
 * The gallery and av views now reuse the same edit function.
 * Simpler registration.
 * `setContent` will call `setIframes` itself if needed.
 * Selecting another view will pause all players. We could also limit this
 to the same view type or a set of view types. This allows us to remove a
 lot of code.
 * Better documentation (though it could be better still).
 * Move the main API to the top of the file.
 * Wrap the view registration in a separate IIFE. Ideally this should go in
 a separate file.
 * The `render` method is easier to override.
 * Better detection of already rendered views, so we don't unnecessarily
 refresh views.
 * I added a proper `setLoader` method, just like `setError`.
 * All options set in `toView` are now added as properties of the instance.

 I will do some more testing.
 Suggestion are welcome.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31412#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list