Skip to content

Conversation

@Monica-Wood
Copy link
Contributor

This enables users to both add images via URL and style them (Add caption, Alt Text, positioning and sizing).

For the image styling to work, you need to disable htmlpurifier in its current form, as it doesn't support HTML5. Suggest moving to the newer htmlpurifier with HTML5 definitions library: https://github.com/xemlock/htmlpurifier-html5 as ezyang has refused to support html5

For pawtucket to style the images correctly, the ck-content class needs to be added to blocks with ckeditor content.

Also a few extra clean ups, like using a separator, adding highlighting and special characters. Turned on grouping, to make the editor tidier. Resizable was missing from the htmlFormHelper.

If it helps. This is the editor toolbar config I have been using:

wysiwyg_editor_toolbar = {
        formatting = [Undo, Redo, -, Source, -, Header, Bold, Italic, Underline, Strike, Subscript, Superscript, RemoveFormat, -],
        insert = [Link, Image, Video, Table, Highlight, Blockquote, SpecialCharacters, -],
        lists = [BulletedList, NumberedList, Outdent, Indent]
}

I didn't change it in this commit, not knowing how many out there use the default outlay, but feel free to update it if you think it's a better structure.

Future development:

  • Add ability to upload images using the editor (storing in a directory in media)
  • Update purifier to use HTML definitions so this can be used with purifier still on.

This will enable the ability to link to an image via URL only at this
stage, but allow the user to style their images. The CKEditor5 CSS needs
to be added to Pawtucket theme to allow for this.
This will hopefully allow the HTML 5 elements needed for image insertion
without needing to fully disable HTMLPurifier.  I will be looking at
trying out the HTMLPurifier Plugin at
https://github.com/xemlock/htmlpurifier-html5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant