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

Port rich text field registration off of XSLT #1862

Open
wants to merge 12 commits into
base: hermione
Choose a base branch
from

Conversation

philipcaisip
Copy link
Contributor

No description provided.

Phil Caisip added 6 commits June 7, 2024 12:28
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.
@JohnMcGuinness
Copy link
Contributor

It should be noted that WebKit does not suppport extending elements

@ricksbrown
Copy link
Member

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

Phil Caisip added 6 commits June 19, 2024 16:02
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.
Copy link

sonarqubecloud bot commented Jul 2, 2024

@philipcaisip philipcaisip marked this pull request as ready for review July 2, 2024 01:09
@philipcaisip philipcaisip requested a review from ricksbrown July 2, 2024 01:09
@philipcaisip
Copy link
Contributor Author

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.

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.

3 participants