Opened 11 years ago

Last modified 11 years ago

#11300 closed Task

Image2: polishing and refactoring of internals — at Version 10

Reported by: Olek Nowodziński Owned by: Olek Nowodziński
Priority: Normal Milestone: CKEditor 4.4.0
Component: General Version: 4.3
Keywords: Drupal Cc: wim.leers@…

Description (last modified by Olek Nowodziński)

Some refactoring got to be done to make Image2 flexible and "environment-friendly". Those changes are relevant for third-party developers, e.g. for D8.

  1. The internal form of the widget got to be styleable: instead of inline styles, we need to introduce classes. With inline styles, the look of the widget is not configurable and possibly incompatible with custom stylesheets during editor's lifetime.
    1. The non-captioned image should have no class.
    2. The class of captioned image must be configurable via config.image2_captionedClass and applied to <figure class="...">.
    3. Class "caption" is obsolete so it will be removed.
    4. Alignment also must be controlled with classes.
      1. Classes must be configurable
    5. Tons of tests to be aligned to the new API.
  1. We should guarantee that additional attributes (e.g. data-*) are preserved, regardless of the internal state of the widget. Extra attributes must survive any kind of internal processing and re-emerge in editor's output (1:1).
    1. Quite likely it's already working because the image node in DOM is passed along with states of a widget (needs tests).
    2. Alternatively, attributes can be serialized in upcast, saved in widget's data and exploded while downcasting. But let's stick to (a) as an easiest "solution" first.

Change History (10)

comment:1 Changed 11 years ago by Olek Nowodziński

Description: modified (diff)
Summary: Image2 in D8Image2: polishing and refactoring of internals

comment:2 Changed 11 years ago by Olek Nowodziński

Description: modified (diff)

comment:3 Changed 11 years ago by Wim Leers

Cc: wim.leers@… added
Keywords: Drupal added

Following with great interest!

comment:4 Changed 11 years ago by Olek Nowodziński

Development goes on in t/11300 (and corresponding test branch).

comment:5 Changed 11 years ago by Olek Nowodziński

Owner: set to Olek Nowodziński
Status: newreview

Changes in dev branch:

  • Internally, widget alignment is controlled with classes:
    • cke_image_left (replaces float:left)
    • cke_image_right (replaces float:right)
    • cke_image_center (replaces text-align:center and display:inline-block of the figure).
  • Captioned widget's wrapper has default class image. It is available both internally and in data.
    • It's possible to alter the class with CKEDITOR.config.image2_captionedClass.
  • Default caption of captioned widget can be translated (also altered).
    • Available via editor.lang.image2.placeholder.

Changes in test branch: aligned test to latest API, improved several tests.

comment:6 Changed 11 years ago by Olek Nowodziński

Milestone: CKEditor 4.3.2

comment:7 Changed 11 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.3.2CKEditor 4.3.3

We are still discussing the details and we're not yet sure that the change is complete, so I'm postponing this issue, to avoid making wrong decisions.

comment:8 Changed 11 years ago by Olek Nowodziński

Status: reviewassigned

Development is continued in t/11300b rebased on latest master.

comment:9 Changed 11 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.3.3CKEditor 4.4

I changed milestone to 4.4, because it's a change that breaks backward compatibility.

I rebased and force-pushed both branches.

comment:10 Changed 11 years ago by Olek Nowodziński

Description: modified (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy