Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 30... Línea 30...
30
} from './common';
30
} from './common';
31
import MediaImage from './image';
31
import MediaImage from './image';
32
import MediaEmbed from './embed';
32
import MediaEmbed from './embed';
33
import MediaManager from './manager';
33
import MediaManager from './manager';
34
import {getButtonImage} from 'editor_tiny/utils';
34
import {getButtonImage} from 'editor_tiny/utils';
-
 
35
import Selectors from './selectors';
Línea 35... Línea 36...
35
 
36
 
36
const isImage = (node) => node.nodeName.toLowerCase() === 'img';
37
const isImage = (node) => node.nodeName.toLowerCase() === 'img';
Línea 37... Línea 38...
37
const isVideo = (node) => node.nodeName.toLowerCase() === 'video' || node.nodeName.toLowerCase() === 'audio';
38
const isVideo = (node) => node.nodeName.toLowerCase() === 'video' || node.nodeName.toLowerCase() === 'audio';
Línea 71... Línea 72...
71
    });
72
    });
Línea 72... Línea 73...
72
 
73
 
73
    editor.ui.registry.addContextMenu(imageButtonName, {
74
    editor.ui.registry.addContextMenu(imageButtonName, {
74
        update: isImage,
75
        update: isImage,
-
 
76
    });
-
 
77
 
-
 
78
    // Let's check for image file at dragged and dropped and add img-fluid class if it does't have it yet.
-
 
79
    editor.on('SetContent', function() {
-
 
80
        const imgs = editor.getBody().querySelectorAll(`img:not(.${Selectors.IMAGE.styles.responsive})`);
-
 
81
        imgs.forEach(img => img.classList.add(`${Selectors.IMAGE.styles.responsive}`));
75
    });
82
    });
Línea 76... Línea 83...
76
};
83
};
77
 
84
 
78
const registerEmbedCommand = (editor, videoButtonText) => {
85
const registerEmbedCommand = (editor, videoButtonText) => {
Línea 89... Línea 96...
89
        tooltip: videoButtonText,
96
        tooltip: videoButtonText,
90
        onAction: handleEmbedAction,
97
        onAction: handleEmbedAction,
91
        onSetup: api => {
98
        onSetup: api => {
92
            return editor.selection.selectorChangedWithUnbind(
99
            return editor.selection.selectorChangedWithUnbind(
93
                'video:not([data-mce-object]):not([data-mce-placeholder]),' +
100
                'video:not([data-mce-object]):not([data-mce-placeholder]),' +
94
                'audio:not([data-mce-object]):not([data-mce-placeholder])',
101
                'audio:not([data-mce-object]):not([data-mce-placeholder]),' +
-
 
102
                'a:not([data-mce-object]):not([data-mce-placeholder])[class=external-media-provider]',
95
                api.setActive
103
                api.setActive
96
            ).unbind;
104
            ).unbind;
97
        }
105
        }
98
    });
106
    });