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/imagecaption/ 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/imagecaption/utils
*/
/**
* Returns the caption model element from a given image element. Returns `null` if no caption is found.
*
* @param {module:engine/model/element~Element} imageModelElement
* @returns {module:engine/model/element~Element|null}
*/
export function getCaptionFromImageModelElement( imageModelElement ) {
for ( const node of imageModelElement.getChildren() ) {
if ( !!node && node.is( 'element', 'caption' ) ) {
return node;
}
}
return null;
}
/**
* Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.
*
* @param {module:image/imageutils~ImageUtils} imageUtils
* @param {module:engine/model/selection~Selection} selection
* @returns {module:engine/model/element~Element|null}
*/
export function getCaptionFromModelSelection( imageUtils, selection ) {
const captionElement = selection.getFirstPosition().findAncestor( 'caption' );
if ( !captionElement ) {
return null;
}
if ( imageUtils.isBlockImage( captionElement.parent ) ) {
return captionElement;
}
return null;
}
/**
* {@link module:engine/view/matcher~Matcher} pattern. Checks if a given element is a `<figcaption>` element that is placed
* inside the image `<figure>` element.
*
* @param {module:image/imageutils~ImageUtils} imageUtils
* @param {module:engine/view/element~Element} element
* @returns {Object|null} Returns the object accepted by {@link module:engine/view/matcher~Matcher} or `null` if the element
* cannot be matched.
*/
export function matchImageCaptionViewElement( imageUtils, element ) {
// Convert only captions for images.
if ( element.name == 'figcaption' && imageUtils.isBlockImageView( element.parent ) ) {
return { name: true };
}
return null;
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0044 ]-- |