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-table/src/utils/ 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 table/utils/common
*/
/**
* A common method to update the numeric value. If a value is the default one, it will be unset.
*
* @param {String} key An attribute key.
* @param {*} value The new attribute value.
* @param {module:engine/model/item~Item} item A model item on which the attribute will be set.
* @param {module:engine/model/writer~Writer} writer
* @param {*} defaultValue The default attribute value. If a value is lower or equal, it will be unset.
*/
export function updateNumericAttribute( key, value, item, writer, defaultValue = 1 ) {
if ( value > defaultValue ) {
writer.setAttribute( key, value, item );
} else {
writer.removeAttribute( key, item );
}
}
/**
* A common method to create an empty table cell. It creates a proper model structure as a table cell must have at least one block inside.
*
* @param {module:engine/model/writer~Writer} writer The model writer.
* @param {module:engine/model/position~Position} insertPosition The position at which the table cell should be inserted.
* @param {Object} attributes The element attributes.
* @returns {module:engine/model/element~Element} Created table cell.
*/
export function createEmptyTableCell( writer, insertPosition, attributes = {} ) {
const tableCell = writer.createElement( 'tableCell', attributes );
writer.insertElement( 'paragraph', tableCell );
writer.insert( tableCell, insertPosition );
return tableCell;
}
/**
* Checks if a table cell belongs to the heading column section.
*
* @param {module:table/tableutils~TableUtils} tableUtils
* @param {module:engine/model/element~Element} tableCell
* @returns {Boolean}
*/
export function isHeadingColumnCell( tableUtils, tableCell ) {
const table = tableCell.parent.parent;
const headingColumns = parseInt( table.getAttribute( 'headingColumns' ) || 0 );
const { column } = tableUtils.getCellLocation( tableCell );
return !!headingColumns && column < headingColumns;
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0047 ]-- |