Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 1... Línea 1...
1
/**
1
/**
2
 * TinyMCE version 6.8.3 (2024-02-08)
2
 * TinyMCE version 7.7.1 (2025-03-05)
3
 */
3
 */
Línea 4... Línea 4...
4
 
4
 
5
(function () {
5
(function () {
Línea 37... Línea 37...
37
    const getBulletStyles = option('advlist_bullet_styles');
37
    const getBulletStyles = option('advlist_bullet_styles');
Línea 38... Línea 38...
38
 
38
 
39
    const isNullable = a => a === null || a === undefined;
39
    const isNullable = a => a === null || a === undefined;
Línea 40... Línea -...
40
    const isNonNullable = a => !isNullable(a);
-
 
41
 
-
 
42
    var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
40
    const isNonNullable = a => !isNullable(a);
43
 
41
 
44
    class Optional {
42
    class Optional {
45
      constructor(tag, value) {
43
      constructor(tag, value) {
46
        this.tag = tag;
44
        this.tag = tag;
Línea 132... Línea 130...
132
        return this.tag ? `some(${ this.value })` : 'none()';
130
        return this.tag ? `some(${ this.value })` : 'none()';
133
      }
131
      }
134
    }
132
    }
135
    Optional.singletonNone = new Optional(false);
133
    Optional.singletonNone = new Optional(false);
Línea -... Línea 134...
-
 
134
 
-
 
135
    const nativeIndexOf = Array.prototype.indexOf;
-
 
136
    const rawIndexOf = (ts, t) => nativeIndexOf.call(ts, t);
136
 
137
    const contains = (xs, x) => rawIndexOf(xs, x) > -1;
137
    const findUntil = (xs, pred, until) => {
138
    const findUntil = (xs, pred, until) => {
138
      for (let i = 0, len = xs.length; i < len; i++) {
139
      for (let i = 0, len = xs.length; i < len; i++) {
139
        const x = xs[i];
140
        const x = xs[i];
140
        if (pred(x, i)) {
141
        if (pred(x, i)) {
Línea 144... Línea 145...
144
        }
145
        }
145
      }
146
      }
146
      return Optional.none();
147
      return Optional.none();
147
    };
148
    };
Línea -... Línea 149...
-
 
149
 
-
 
150
    const keys = Object.keys;
-
 
151
    const each = (obj, f) => {
-
 
152
      const props = keys(obj);
-
 
153
      for (let k = 0, len = props.length; k < len; k++) {
-
 
154
        const i = props[k];
-
 
155
        const x = obj[i];
-
 
156
        f(x, i);
-
 
157
      }
-
 
158
    };
-
 
159
    const map = (obj, f) => {
-
 
160
      return tupleMap(obj, (x, i) => ({
-
 
161
        k: i,
-
 
162
        v: f(x, i)
-
 
163
      }));
-
 
164
    };
-
 
165
    const tupleMap = (obj, f) => {
-
 
166
      const r = {};
-
 
167
      each(obj, (x, i) => {
-
 
168
        const tuple = f(x, i);
-
 
169
        r[tuple.k] = tuple.v;
-
 
170
      });
-
 
171
      return r;
-
 
172
    };
-
 
173
 
-
 
174
    var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
148
 
175
 
149
    const isCustomList = list => /\btox\-/.test(list.className);
176
    const isCustomList = list => /\btox\-/.test(list.className);
150
    const isChildOfBody = (editor, elm) => {
177
    const isChildOfBody = (editor, elm) => {
151
      return editor.dom.isChildOf(elm, editor.getBody());
178
      return editor.dom.isChildOf(elm, editor.getBody());
152
    };
179
    };
Línea 160... Línea 187...
160
      return Optional.from(style);
187
      return Optional.from(style);
161
    };
188
    };
162
    const isWithinNonEditable = (editor, element) => element !== null && !editor.dom.isEditable(element);
189
    const isWithinNonEditable = (editor, element) => element !== null && !editor.dom.isEditable(element);
163
    const isWithinNonEditableList = (editor, element) => {
190
    const isWithinNonEditableList = (editor, element) => {
164
      const parentList = editor.dom.getParent(element, 'ol,ul,dl');
191
      const parentList = editor.dom.getParent(element, 'ol,ul,dl');
165
      return isWithinNonEditable(editor, parentList) && editor.selection.isEditable();
192
      return isWithinNonEditable(editor, parentList) || !editor.selection.isEditable();
166
    };
193
    };
167
    const setNodeChangeHandler = (editor, nodeChangeHandler) => {
194
    const setNodeChangeHandler = (editor, nodeChangeHandler) => {
168
      const initialNode = editor.selection.getNode();
195
      const initialNode = editor.selection.getNode();
169
      nodeChangeHandler({
196
      nodeChangeHandler({
170
        parents: editor.dom.getParents(initialNode),
197
        parents: editor.dom.getParents(initialNode),
Línea 182... Línea 209...
182
    const normalizeStyleValue = styleValue => isNullable(styleValue) || styleValue === 'default' ? '' : styleValue;
209
    const normalizeStyleValue = styleValue => isNullable(styleValue) || styleValue === 'default' ? '' : styleValue;
183
    const makeSetupHandler = (editor, nodeName) => api => {
210
    const makeSetupHandler = (editor, nodeName) => api => {
184
      const updateButtonState = (editor, parents) => {
211
      const updateButtonState = (editor, parents) => {
185
        const element = editor.selection.getStart(true);
212
        const element = editor.selection.getStart(true);
186
        api.setActive(inList(editor, parents, nodeName));
213
        api.setActive(inList(editor, parents, nodeName));
187
        api.setEnabled(!isWithinNonEditableList(editor, element) && editor.selection.isEditable());
214
        api.setEnabled(!isWithinNonEditableList(editor, element));
188
      };
215
      };
189
      const nodeChangeHandler = e => updateButtonState(editor, e.parents);
216
      const nodeChangeHandler = e => updateButtonState(editor, e.parents);
190
      return setNodeChangeHandler(editor, nodeChangeHandler);
217
      return setNodeChangeHandler(editor, nodeChangeHandler);
191
    };
218
    };
192
    const addSplitButton = (editor, id, tooltip, cmd, nodeName, styles) => {
219
    const addSplitButton = (editor, id, tooltip, cmd, nodeName, styles) => {
-
 
220
      const listStyleTypeAliases = {
-
 
221
        'lower-latin': 'lower-alpha',
-
 
222
        'upper-latin': 'upper-alpha',
-
 
223
        'lower-alpha': 'lower-latin',
-
 
224
        'upper-alpha': 'upper-latin'
-
 
225
      };
-
 
226
      const stylesContainsAliasMap = map(listStyleTypeAliases, alias => contains(styles, alias));
193
      editor.ui.registry.addSplitButton(id, {
227
      editor.ui.registry.addSplitButton(id, {
194
        tooltip,
228
        tooltip,
195
        icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',
229
        icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',
196
        presets: 'listpreview',
230
        presets: 'listpreview',
197
        columns: 3,
231
        columns: 3,
Línea 214... Línea 248...
214
        onItemAction: (_splitButtonApi, value) => {
248
        onItemAction: (_splitButtonApi, value) => {
215
          applyListFormat(editor, nodeName, value);
249
          applyListFormat(editor, nodeName, value);
216
        },
250
        },
217
        select: value => {
251
        select: value => {
218
          const listStyleType = getSelectedStyleType(editor);
252
          const listStyleType = getSelectedStyleType(editor);
219
          return listStyleType.map(listStyle => value === listStyle).getOr(false);
253
          return listStyleType.exists(listStyle => value === listStyle || listStyleTypeAliases[listStyle] === value && !stylesContainsAliasMap[value]);
220
        },
254
        },
221
        onSetup: makeSetupHandler(editor, nodeName)
255
        onSetup: makeSetupHandler(editor, nodeName)
222
      });
256
      });
223
    };
257
    };
224
    const addButton = (editor, id, tooltip, cmd, nodeName, styleValue) => {
258
    const addButton = (editor, id, tooltip, cmd, nodeName, styleValue) => {
Línea 247... Línea 281...
247
        if (editor.hasPlugin('lists')) {
281
        if (editor.hasPlugin('lists')) {
248
          register$1(editor);
282
          register$1(editor);
249
          register(editor);
283
          register(editor);
250
          register$2(editor);
284
          register$2(editor);
251
        } else {
285
        } else {
252
          console.error('Please use the Lists plugin together with the Advanced List plugin.');
286
          console.error('Please use the Lists plugin together with the List Styles plugin.');
253
        }
287
        }
254
      });
288
      });
255
    };
289
    };
Línea 256... Línea 290...
256
 
290