Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-27628: Implement editing support for RichText FieldType #151

Merged
merged 1 commit into from Sep 20, 2017

Conversation

webhdx
Copy link
Contributor

@webhdx webhdx commented Aug 29, 2017

JIRA: https://jira.ez.no/browse/EZP-27628
!! Please do not merge until #140 is merged. I have to rebase on master and skip duplicated commit first !!

Description

This PR provides basic editing support for:

It exposes <textarea></textarea> element accepting RichText's XML markup.

Please note it isn't prepared for Content translation yet. It also requires JS enrichment done in Hybrid UI.

## Changes
- EZP-27628: Implement editing support for RichText FieldType

What changed: `ezrepoforms.field_type.form_mapper.ezrichtext` requries `ezpublish.api.service.field_type` dependency.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires

return '';
}

return (string) $value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I get that correctly, that means the textarea will be filled with the XML internal format (docbook) which won't be super usable to have a Rich Text editor :)
Instead, the textarea should be filled with xhtml5edit representation of the field value

Copy link
Contributor Author

@webhdx webhdx Aug 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you are right. I wasn't aware we are using two different schemas. The fact we are using some processors doing work "behind the scenes" didn't help either. Anyway, fixed it.

return $this->fieldType->getEmptyValue();
}

return $this->fieldType->fromHash(['xml' => $value]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and maybe same here, is it enough to accept an xhtml5edit document ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny fact - This is how it works in PlatformUI. UI is sending JSON object with xml and xhtml5edit properties but both contain the same markup (xhtml5edit). Kinda hackish but it is later picked up by a processor which is identifying the schema and converting to docbook. It works the way its implemented above as fromHash() is taking care of it.

@webhdx webhdx force-pushed the EZP-27628_richtext branch 4 times, most recently from 8a29ed0 to c7db8a1 Compare September 6, 2017 12:07
@lserwatka lserwatka merged commit 48c1ff4 into ezsystems:master Sep 20, 2017
@webhdx webhdx deleted the EZP-27628_richtext branch September 27, 2017 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants