Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 26... Línea 26...
26
import {getDefaultConfiguration, getDefaultQuickbarsSelectionToolbar} from './defaults';
26
import {getDefaultConfiguration, getDefaultQuickbarsSelectionToolbar} from './defaults';
27
import {getTinyMCE, baseUrl} from './loader';
27
import {getTinyMCE, baseUrl} from './loader';
28
import * as Options from './options';
28
import * as Options from './options';
29
import {addToolbarButton, addToolbarButtons, addToolbarSection,
29
import {addToolbarButton, addToolbarButtons, addToolbarSection,
30
    removeToolbarButton, removeSubmenuItem, updateEditorState} from './utils';
30
    removeToolbarButton, removeSubmenuItem, updateEditorState} from './utils';
-
 
31
import {addMathMLSupport, addSVGSupport} from './content';
-
 
32
import Config from 'core/config';
Línea 31... Línea 33...
31
 
33
 
32
/**
34
/**
33
 * Storage for the TinyMCE instances on the page.
35
 * Storage for the TinyMCE instances on the page.
34
 * @type {Map}
36
 * @type {Map}
Línea 152... Línea 154...
152
 * Currently this includes the language taken from the HTML lang property.
154
 * Currently this includes the language taken from the HTML lang property.
153
 */
155
 */
154
const initialisePage = async() => {
156
const initialisePage = async() => {
155
    const lang = document.querySelector('html').lang;
157
    const lang = document.querySelector('html').lang;
Línea 156... Línea 158...
156
 
158
 
157
    const [tinyMCE, langData] = await Promise.all([getTinyMCE(), fetchLanguage(lang)]);
159
    const [tinyMCE, langData] = await Promise.all([getTinyMCE(), fetchLanguage(Config.language)]);
158
    tinyMCE.addI18n(lang, langData);
160
    tinyMCE.addI18n(lang, langData);
159
};
161
};
Línea 160... Línea 162...
160
initialisePage();
162
initialisePage();
Línea 235... Línea 237...
235
        // Set the language.
237
        // Set the language.
236
        // https://www.tiny.cloud/docs/tinymce/6/ui-localization/#language
238
        // https://www.tiny.cloud/docs/tinymce/6/ui-localization/#language
237
        // eslint-disable-next-line camelcase
239
        // eslint-disable-next-line camelcase
238
        language: lang,
240
        language: lang,
Línea -... Línea 241...
-
 
241
 
-
 
242
        // Disable default iframe sandboxing.
-
 
243
        // https://www.tiny.cloud/docs/tinymce/latest/content-filtering/#sandbox-iframes
-
 
244
        // eslint-disable-next-line camelcase
-
 
245
        sandbox_iframes: false,
239
 
246
 
240
        // Load the editor stylesheet into the editor iframe.
247
        // Load the editor stylesheet into the editor iframe.
241
        // https://www.tiny.cloud/docs/tinymce/6/add-css-options/
248
        // https://www.tiny.cloud/docs/tinymce/6/add-css-options/
242
        // eslint-disable-next-line camelcase
249
        // eslint-disable-next-line camelcase
243
        content_css: [
250
        content_css: [
Línea 255... Línea 262...
255
        // eslint-disable-next-line camelcase
262
        // eslint-disable-next-line camelcase
256
        a11y_advanced_options: true,
263
        a11y_advanced_options: true,
Línea 257... Línea 264...
257
 
264
 
258
        // Add specific rules to the valid elements.
265
        // Add specific rules to the valid elements.
259
        // eslint-disable-next-line camelcase
266
        // eslint-disable-next-line camelcase
Línea 260... Línea 267...
260
        extended_valid_elements: 'script[*],p[*],i[*]',
267
        extended_valid_elements: options.extended_valid_elements,
261
 
268
 
262
        // Disable XSS Sanitisation.
269
        // Disable XSS Sanitisation.
263
        // We do this in PHP.
270
        // We do this in PHP.
Línea 277... Línea 284...
277
        quickbars_selection_toolbar: target.rows > 5 ? getDefaultQuickbarsSelectionToolbar() : false,
284
        quickbars_selection_toolbar: target.rows > 5 ? getDefaultQuickbarsSelectionToolbar() : false,
Línea 278... Línea 285...
278
 
285
 
279
        // Override the standard block formats property (removing h1 & h2).
286
        // Override the standard block formats property (removing h1 & h2).
280
        // https://www.tiny.cloud/docs/tinymce/6/user-formatting-options/#block_formats
287
        // https://www.tiny.cloud/docs/tinymce/6/user-formatting-options/#block_formats
281
        // eslint-disable-next-line camelcase
288
        // eslint-disable-next-line camelcase
Línea 282... Línea 289...
282
        block_formats: 'Paragraph=p;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre',
289
        block_formats: 'Paragraph=p;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;Blockquote=blockquote',
283
 
290
 
284
        // The list of plugins to include in the instance.
291
        // The list of plugins to include in the instance.
285
        // https://www.tiny.cloud/docs/tinymce/6/editor-important-options/#plugins
292
        // https://www.tiny.cloud/docs/tinymce/6/editor-important-options/#plugins
Línea 321... Línea 328...
321
        // Enable browser-supported spell checking.
328
        // Enable browser-supported spell checking.
322
        // https://www.tiny.cloud/docs/tinymce/latest/spelling/
329
        // https://www.tiny.cloud/docs/tinymce/latest/spelling/
323
        // eslint-disable-next-line camelcase
330
        // eslint-disable-next-line camelcase
324
        browser_spellcheck: true,
331
        browser_spellcheck: true,
Línea -... Línea 332...
-
 
332
 
-
 
333
        // Set the license_key to gpl.
-
 
334
        // https://www.tiny.cloud/docs/tinymce/latest/license-key/
-
 
335
        // eslint-disable-next-line camelcase
-
 
336
        license_key: 'gpl',
-
 
337
 
-
 
338
        // Disable the Alt+F12 shortcut.
-
 
339
        // This was introduced in Tiny 7.1 to focus notifications, but it conflicts with the German keyboard layout
-
 
340
        // which uses Alt+F12 to access the open curly brace.
-
 
341
        // This is an upstream problem with TinyMCE and should be fixed in a future release.
-
 
342
        // The recommended workaround is to disable the shortcut.
-
 
343
        // See MDL-83257 for further information.
-
 
344
        // eslint-disable-next-line camelcase
-
 
345
        init_instance_callback: (editor) => {
-
 
346
            editor.shortcuts.remove('alt+f12');
-
 
347
        },
325
 
348
 
326
        setup: (editor) => {
349
        setup: (editor) => {
Línea 327... Línea 350...
327
            Options.register(editor, options);
350
            Options.register(editor, options);
328
 
351
 
Línea 339... Línea 362...
339
                removeSubmenuItem(editor, 'align', 'tiny:justify');
362
                removeSubmenuItem(editor, 'align', 'tiny:justify');
340
                // Adjust the editor size.
363
                // Adjust the editor size.
341
                adjustEditorSize(editor, target);
364
                adjustEditorSize(editor, target);
342
            });
365
            });
Línea -... Línea 366...
-
 
366
 
-
 
367
            addMathMLSupport(editor);
-
 
368
            addSVGSupport(editor);
343
 
369
 
344
            target.addEventListener('form:editorUpdated', function() {
370
            target.addEventListener('form:editorUpdated', function() {
345
                updateEditorState(editor, target);
371
                updateEditorState(editor, target);
Línea 346... Línea 372...
346
            });
372
            });