/** * 获取不可以参与格式化的元素 */ * _getNotFormattingItems(selection, schema) { // Check formatting on selected items that are not blocks. for (const curRange of selection.getRanges()) { for (const item of curRange.getItems()) { if (!schema.isBlock(item)) { yield item; } } }
// Check formatting from selected blocks. for (const block of selection.getSelectedBlocks()) { if (block) { yield block; } }
// Finally the selection might be formatted as well, so make sure to check it. if (selection) { yield selection; } }