-
Notifications
You must be signed in to change notification settings - Fork 17
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
Port rich text field registration off of XSLT #1862
base: hermione
Are you sure you want to change the base?
Conversation
Starting simple code to port RTF registration from XSLT into HTML custom components. Still need some way of testing actual TinyMCE import and use.
TinyMCE adds its own forward slash when stringing together urls for loading plugins ands themes etc. This made a double // in the url since resourceLoader takes urls with the / suffix already there. This extra / is currently being cut off in rtf.mjs. Although, it may be better off getting cut in resourceLoader.getUrlFromImportMap().
Switched from using the ui:rtf element in the raw XML to using wc-rtf custom HTML components. Still need a way to import the rtf module without the XSLT and to do further unit testing to get better coverage on rtf.mjs.
Instead of using a blank custom element to mark rtf fields, the actual input textarea element is extended as a custom element. This is to handle the rtf import problem, since now it is easy to detect when the rtf module should be imported through the existance of the textarea in textarea.mjs. Potential problem: this functionality only plays nice with rtf components that are not read-only. This is not a problem if components are unable to switch between being read-only and not, since read-only rtf fields don't seem to have a need to be registered through TinyMCE. If that is not the case, however, it will have to be accounted for in another way.
This is to avoid any errors that may be caused by fetching chars from null values.
It should be noted that WebKit does not suppport extending elements |
Oh darn it! You are right! Nowadays that means Safari. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is#browser_compatibility |
Due to webkit not supporting the extension of existing html elements custom ones, regular custom elements have to be used. It is back to using the empty wc-rtf marker element. Note that the definition of this element is still done in textArea.mjs, so rtf.mjs can continue being imported on-demnad.
This is as advised in another fix (eager components port) since we are trying to move away from XML entirely anyways.
Using a mock of TinyMCE, rtf is now tested for default configuration. Slight remodel of the rtf code to use resourceLoader to import TinyMCE was also done. This was to make it possible to mock TinyMCE by pointing the testing suite towards the mock with an import map in the DOM.
RTF tests were previously faililng when run after the initialise tests, since it changes that suite changes the dom and doesn't change it back. This has been fixed up and all tests are passing now.
Quality Gate passedIssues Measures |
Hi @ricksbrown, this is ready to review now. RTFs are marked with a custom HTML component that then get passed to TinyMCE, instead of the XSLT doing that. There's also some new unit tests that use a mock TinyMCE, which I've put in a new mock-modules folder. |
No description provided.