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 320... Línea 320...
320
 
320
 
321
    const parseIntAndGetMax = (val1, val2) => Math.max(parseInt(val1, 10), parseInt(val2, 10));
321
    const parseIntAndGetMax = (val1, val2) => Math.max(parseInt(val1, 10), parseInt(val2, 10));
322
    const getImageSize = url => new Promise(callback => {
322
    const getImageSize = url => new Promise(callback => {
323
      const img = document.createElement('img');
323
      const img = document.createElement('img');
324
      const done = dimensions => {
-
 
325
        img.onload = img.onerror = null;
324
      const done = dimensions => {
326
        if (img.parentNode) {
325
        if (img.parentNode) {
327
          img.parentNode.removeChild(img);
326
          img.parentNode.removeChild(img);
328
        }
327
        }
329
        callback(dimensions);
328
        callback(dimensions);
330
      };
329
      };
331
      img.onload = () => {
330
      img.addEventListener('load', () => {
332
        const width = parseIntAndGetMax(img.width, img.clientWidth);
331
        const width = parseIntAndGetMax(img.width, img.clientWidth);
333
        const height = parseIntAndGetMax(img.height, img.clientHeight);
332
        const height = parseIntAndGetMax(img.height, img.clientHeight);
334
        const dimensions = {
333
        const dimensions = {
335
          width,
334
          width,
336
          height
335
          height
337
        };
336
        };
338
        done(Promise.resolve(dimensions));
337
        done(Promise.resolve(dimensions));
339
      };
338
      });
340
      img.onerror = () => {
339
      img.addEventListener('error', () => {
341
        done(Promise.reject(`Failed to get image dimensions for: ${ url }`));
340
        done(Promise.reject(`Failed to get image dimensions for: ${ url }`));
342
      };
341
      });
343
      const style = img.style;
342
      const style = img.style;
344
      style.visibility = 'hidden';
343
      style.visibility = 'hidden';
345
      style.position = 'fixed';
344
      style.position = 'fixed';
346
      style.bottom = style.left = '0px';
345
      style.bottom = style.left = '0px';
Línea 740... Línea 739...
740
      const image = getSelectedImage(editor);
739
      const image = getSelectedImage(editor);
741
      if (image) {
740
      if (image) {
742
        write(css => normalizeCss$1(editor, css), data, image);
741
        write(css => normalizeCss$1(editor, css), data, image);
743
        syncSrcAttr(editor, image);
742
        syncSrcAttr(editor, image);
744
        if (isFigure(image.parentNode)) {
743
        if (isFigure(image.parentNode)) {
-
 
744
          editor.dom.setStyle(image, 'float', '');
745
          const figure = image.parentNode;
745
          const figure = image.parentNode;
746
          splitTextBlock(editor, figure);
746
          splitTextBlock(editor, figure);
747
          editor.selection.select(image.parentNode);
747
          editor.selection.select(image.parentNode);
748
        } else {
748
        } else {
749
          editor.selection.select(image);
749
          editor.selection.select(image);
Línea 1277... Línea 1277...
1277
              meta: {}
1277
              meta: {}
1278
            }
1278
            }
1279
          });
1279
          });
1280
          api.showTab('general');
1280
          api.showTab('general');
1281
          changeSrc(helpers, info, state, api);
1281
          changeSrc(helpers, info, state, api);
-
 
1282
          api.focus('src');
1282
        };
1283
        };
1283
        blobToDataUri(file).then(dataUrl => {
1284
        blobToDataUri(file).then(dataUrl => {
1284
          const blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);
1285
          const blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);
1285
          if (info.automaticUploads) {
1286
          if (info.automaticUploads) {
1286
            helpers.uploadImage(blobInfo).then(result => {
1287
            helpers.uploadImage(blobInfo).then(result => {
1287
              updateSrcAndSwitchTab(result.url);
1288
              updateSrcAndSwitchTab(result.url);
1288
              finalize();
1289
              finalize();
1289
            }).catch(err => {
1290
            }).catch(err => {
1290
              finalize();
1291
              finalize();
1291
              helpers.alertErr(err);
1292
              helpers.alertErr(err, () => {
-
 
1293
                api.focus('fileinput');
-
 
1294
              });
1292
            });
1295
            });
1293
          } else {
1296
          } else {
1294
            helpers.addToBlobCache(blobInfo);
1297
            helpers.addToBlobCache(blobInfo);
1295
            updateSrcAndSwitchTab(blobInfo.blobUri());
1298
            updateSrcAndSwitchTab(blobInfo.blobUri());
1296
            api.unblock();
1299
            api.unblock();
Línea 1367... Línea 1370...
1367
      });
1370
      });
1368
    };
1371
    };
1369
    const addToBlobCache = editor => blobInfo => {
1372
    const addToBlobCache = editor => blobInfo => {
1370
      editor.editorUpload.blobCache.add(blobInfo);
1373
      editor.editorUpload.blobCache.add(blobInfo);
1371
    };
1374
    };
1372
    const alertErr = editor => message => {
1375
    const alertErr = editor => (message, callback) => {
1373
      editor.windowManager.alert(message);
1376
      editor.windowManager.alert(message, callback);
1374
    };
1377
    };
1375
    const normalizeCss = editor => cssText => normalizeCss$1(editor, cssText);
1378
    const normalizeCss = editor => cssText => normalizeCss$1(editor, cssText);
1376
    const parseStyle = editor => cssText => editor.dom.parseStyle(cssText);
1379
    const parseStyle = editor => cssText => editor.dom.parseStyle(cssText);
1377
    const serializeStyle = editor => (stylesArg, name) => editor.dom.serializeStyle(stylesArg, name);
1380
    const serializeStyle = editor => (stylesArg, name) => editor.dom.serializeStyle(stylesArg, name);
1378
    const uploadImage = editor => blobInfo => global$1(editor).upload([blobInfo], false).then(results => {
1381
    const uploadImage = editor => blobInfo => global$1(editor).upload([blobInfo], false).then(results => {