Skip to content
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
40 changes: 32 additions & 8 deletions static-assets/js/tinymce-plugins/ace/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,31 @@

(function () {
const PLUGIN_NAME = 'acecode';
const BUTTON_TOOL_TIP = 'Toggle code view mode';

tinymce.addI18n('en', {
'code-editor': 'Code Editor',
'toggle-code-view': 'Toggle code view mode',
fullscreen: 'Fullscreen',
'exit-fullscreen': 'Exit fullscreen'
});
tinymce.addI18n('es', {
'code-editor': 'Editor de Código',
'toggle-code-view': 'Alternar el modo de vista de código',
fullscreen: 'Pantalla completa',
'exit-fullscreen': 'Salir de pantalla completa'
});
tinymce.addI18n('de', {
'code-editor': 'Code-Editor',
'toggle-code-view': 'Codeansichtsmodus umschalten',
fullscreen: 'Vollbild',
'exit-fullscreen': 'Vollbildmodus beenden'
});
tinymce.addI18n('ko_KR', {
'code-editor': '코드 편집기',
'toggle-code-view': '코드 보기 모드 전환',
fullscreen: '전체 화면',
'exit-fullscreen': '전체 화면 종료'
});
Comment thread
jvega190 marked this conversation as resolved.

tinymce.PluginManager.add(PLUGIN_NAME, function (editor, url) {
const aceModes = {
Expand Down Expand Up @@ -52,14 +76,14 @@
let isActive = true;
editor.ui.registry.addButton(PLUGIN_NAME, {
icon: 'sourcecode',
tooltip: BUTTON_TOOL_TIP,
tooltip: editor.translate('toggle-code-view'),
onAction: function () {
onAction(this, editor);
}
});
editor.ui.registry.addMenuItem(PLUGIN_NAME, {
icon: 'sourcecode',
text: 'Code Editor',
text: editor.translate('code-editor'),
onAction: function () {
onAction(this, editor);
}
Expand Down Expand Up @@ -94,12 +118,12 @@
aceContainer.innerHTML =
`<div class="inline-container-header">` +
`<button id="${aceID}-toggleCode" class="acecode-inline-btn toggle" ` +
` title="${BUTTON_TOOL_TIP}" type="button" tabIndex="-1" ` +
` title="${editor.translate('toggle-code-view')}" type="button" tabIndex="-1" ` +
'>' +
icons.sourceCode +
'</button>' +
`<button id="${aceID}-fullscreenMode" class="acecode-inline-btn fullscreen"` +
' title="Fullscreen" type="button" tabIndex="-1"' +
` title="${editor.translate('fullscreen')}" type="button" tabIndex="-1"` +
'>' +
icons.resize +
'</button></div>' +
Expand Down Expand Up @@ -154,7 +178,7 @@

const showDialog = function (editor, fullscreenMode) {
editor.windowManager.open({
title: 'Code Editor',
title: editor.translate('code-editor'),
size: 'large',
body: {
type: 'panel',
Expand All @@ -176,10 +200,10 @@
// Inline mode is the one used in forms (when on ICE inlineMode is set to false to always use modal)
if (inlineMode) {
if (fullscreenMode) {
dialogCloseIcon.setAttribute('title', 'Toggle code view mode');
dialogCloseIcon.setAttribute('title', editor.translate('toggle-code-view'));
dialogCloseIcon.querySelector('.tox-icon').innerHTML = icons.sourceCode;
} else {
dialogCloseIcon.setAttribute('title', 'Exit fullscreen');
dialogCloseIcon.setAttribute('title', editor.translate('exit-fullscreen'));
dialogCloseIcon.querySelector('.tox-icon').innerHTML = icons.resize;
}
}
Expand Down
2 changes: 1 addition & 1 deletion static-assets/js/tinymce-plugins/ace/plugin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const rteDescriptor: DescriptorContentType = {
title: defineMessage({ defaultMessage: 'Options' }),
fields: [
'height',
'maxlength',
'autoGrow',
'enableSpellCheck',
'rteConfiguration',
Expand All @@ -53,6 +54,13 @@ export const rteDescriptor: DescriptorContentType = {
defaultValue: undefined,
validations: immutableEmptyObject
},
maxlength: {
id: 'maxlength',
type: 'int',
name: defineMessage({ defaultMessage: 'Max Length' }),
defaultValue: undefined,
validations: immutableEmptyObject
},
autoGrow: {
id: 'autoGrow',
type: 'boolean',
Expand Down
1 change: 1 addition & 0 deletions ui/app/src/components/FormsEngine/FormsEngineDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function FormsEngineDialog(props: FormsEngineDialogProps) {
maxWidth="xl"
title="Content Form"
data-area-id="forms-engine-dialog-root"
disableEnforceFocus={true} // This allows TinyMCE popups to gain focus (e.g. code editor, needs focus to be able to type in it)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a bit of an issue. Please research MUI's dialog focus manager and talk to the robot to see if there's a way to sort of integrate and inform MUI of a dialog outside the MUI onces and get back to me. Talk to the robots for help too.

>
<FormsEngine
onMinimize={props.onMinimize}
Expand Down
Loading