| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- /**
- * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
- /* globals console:false, window, document, CKEditorInspector */
- import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
- import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
- import LinkImage from '../../src/linkimage';
- // Just to have nicely styles switchbutton;
- import '@ckeditor/ckeditor5-theme-lark/theme/ckeditor5-ui/components/list/list.css';
- window.editors = {};
- ClassicEditor
- .create( document.querySelector( '#editor' ), {
- plugins: [ ArticlePluginSet, LinkImage ],
- toolbar: [ 'link', 'undo', 'redo' ],
- link: {
- decorators: {
- isExternal: {
- mode: 'manual',
- label: 'Open in a new tab',
- attributes: {
- target: '_blank',
- rel: 'noopener noreferrer'
- }
- },
- isDownloadable: {
- mode: 'manual',
- label: 'Downloadable',
- attributes: {
- download: 'download'
- }
- },
- isGallery: {
- mode: 'manual',
- label: 'Gallery link',
- attributes: {
- class: 'gallery'
- }
- }
- }
- },
- image: {
- toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative', '|', 'linkImage' ]
- }
- } )
- .then( editor => {
- CKEditorInspector.attach( 'manual', editor );
- window.editors.manualDecorators = editor;
- } )
- .catch( err => {
- console.error( err.stack );
- } );
- ClassicEditor
- .create( document.querySelector( '#editor2' ), {
- plugins: [ ArticlePluginSet, LinkImage ],
- toolbar: [ 'link', 'undo', 'redo' ],
- link: {
- decorators: {
- isTelephone: {
- mode: 'automatic',
- callback: url => url.startsWith( 'tel:' ),
- attributes: {
- class: 'phone'
- }
- },
- isInternal: {
- mode: 'automatic',
- callback: url => url.startsWith( '#' ),
- attributes: {
- class: 'internal'
- }
- }
- },
- addTargetToExternalLinks: true
- },
- image: {
- toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative', '|', 'linkImage' ]
- }
- } )
- .then( editor => {
- CKEditorInspector.attach( 'automatic', editor );
- window.editors.automaticDecorators = editor;
- } )
- .catch( err => {
- console.error( err.stack );
- } );
|