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

[7628] Update RTE control to accommodate Tiny 7 changes #4304

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions static-assets/components/cstudio-forms/controls/rte.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,6 @@ CStudioAuthoring.Module.requireModule(
type: 'boolean',
defaultValue: 'true'
},
{
label: this.formatMessage(this.contentTypesMessages.forceRootBlockP),
name: 'forceRootBlockPTag',
type: 'boolean',
defaultValue: 'true'
},
{
label: this.formatMessage(this.contentTypesMessages.forceBRNewLines),
name: 'forceBRTags',
type: 'boolean',
defaultValue: 'false'
},
{
label: this.formatMessage(this.contentTypesMessages.supportedChannels),
name: 'supportedChannels',
Expand Down Expand Up @@ -319,12 +307,6 @@ CStudioAuthoring.Module.requireModule(
case 'maxlength':
inputEl.maxlength = prop.value;
break;
case 'forceBRTags':
var forceBRTags = prop.value == 'true' ? true : false;
break;
case 'forceRootBlockPTag':
var forceRootBlockPTag = prop.value == 'false' ? false : 'p';
break;
case 'enableSpellCheck':
this.enableSpellCheck = !prop.value || prop.value === 'true';
break;
Expand Down Expand Up @@ -385,11 +367,10 @@ CStudioAuthoring.Module.requireModule(
remove_script_host: false,
convert_urls: false,
readonly: _thisControl.readonly, // comes from control props (not xml config)
force_br_newlines: forceBRTags, // comes from control props (not xml config)
forced_root_block: forceRootBlockPTag, // comes from control props (not xml config)
remove_trailing_brs: false,
media_live_embeds: true,
contextmenu: !this.enableSpellCheck, // comes from control props (not xml config)
contextmenu: !this.enableSpellCheck, // comes from control props (not xml config) TODO: Why is spell check tied to context menu? Access removal.
Copy link
Member Author

Choose a reason for hiding this comment

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

@rart https://www.tiny.cloud/docs/tinymce/latest/spell-checking/ according to this doc disabling the contextmenu may be required (though they added that there's an alternative to open the browser context menu).

browser_spellcheck: this.enableSpellCheck, // comes from control props (not xml config)
image_uploadtab: this.editorImageDatasources.length > 0, // comes from control props (not xml config)
craftercms_paste_cleanup: rteConfig?.tinymceOptions?.craftercms_paste_cleanup ?? true, // If doesn't exist or if true => true
automatic_uploads: true,
Expand Down Expand Up @@ -529,8 +510,6 @@ CStudioAuthoring.Module.requireModule(
'external_plugins', // Considered/used above, mixed with our options
'relative_urls', // To avoid allowing convertion of urls to be relative to the document_base_url
'readonly', // Comes from form control props, can't be overridden.
'force_br_newlines', // Comes from form control props, can't be overridden.
'forced_root_block', // Comes from form control props, can't be overridden.
'content_css' // Handled above, if no content_css is found it will use dark/default styles.
)
})
Expand Down
4 changes: 1 addition & 3 deletions ui/guest/src/controls/rte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ export function initTinyMCE(
};

const controlPropsMap = {
enableSpellCheck: 'browser_spellcheck',
forceRootBlockPTag: 'forced_root_block'
enableSpellCheck: 'browser_spellcheck'
};
const controlProps = {};
Object.keys(controlPropsMap).forEach((key) => {
Expand Down Expand Up @@ -149,7 +148,6 @@ export function initTinyMCE(
window.tinymce.activeEditor.plugins.craftercms_paste_extension?.paste_postprocess(plugin, args);
},
toolbar: type === 'html',
forced_root_block: type === 'html',
menubar: false,
inline: true,
base_url: '/studio/static-assets/libs/tinymce',
Expand Down