mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
chore(ckeditor5-footnotes): fix references: Writer -> ModelWriter
This commit is contained in:
parent
275d07659d
commit
23fe76989b
@ -11,7 +11,7 @@ import { defineSchema } from './schema.js';
|
|||||||
import { ATTRIBUTES, COMMANDS, ELEMENTS } from '../constants.js';
|
import { ATTRIBUTES, COMMANDS, ELEMENTS } from '../constants.js';
|
||||||
import InsertFootnoteCommand from '../insert-footnote-command.js';
|
import InsertFootnoteCommand from '../insert-footnote-command.js';
|
||||||
import { modelQueryElement, modelQueryElementsAll } from '../utils.js';
|
import { modelQueryElement, modelQueryElementsAll } from '../utils.js';
|
||||||
import { Autoformat, Batch, ModelElement, Plugin, ModelRootElement, viewToModelPositionOutsideModelElement, Widget, Writer } from 'ckeditor5';
|
import { Autoformat, Batch, ModelElement, Plugin, ModelRootElement, viewToModelPositionOutsideModelElement, Widget, ModelWriter } from 'ckeditor5';
|
||||||
|
|
||||||
export default class FootnoteEditing extends Plugin {
|
export default class FootnoteEditing extends Plugin {
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ export default class FootnoteEditing extends Plugin {
|
|||||||
* batch these changes with the ones that instantiated them,
|
* batch these changes with the ones that instantiated them,
|
||||||
* such that the set can be undone with a single action.
|
* such that the set can be undone with a single action.
|
||||||
*/
|
*/
|
||||||
private _clearContents( modelWriter: Writer, footnoteContent: ModelElement ) {
|
private _clearContents( modelWriter: ModelWriter, footnoteContent: ModelElement ) {
|
||||||
const contents = modelWriter.createRangeIn( footnoteContent );
|
const contents = modelWriter.createRangeIn( footnoteContent );
|
||||||
modelWriter.appendElement( 'paragraph', footnoteContent );
|
modelWriter.appendElement( 'paragraph', footnoteContent );
|
||||||
modelWriter.remove( contents );
|
modelWriter.remove( contents );
|
||||||
@ -155,7 +155,7 @@ export default class FootnoteEditing extends Plugin {
|
|||||||
* which triggers the `updateReferenceIds` method. modelWriter is passed in to batch these changes with
|
* which triggers the `updateReferenceIds` method. modelWriter is passed in to batch these changes with
|
||||||
* the ones that instantiated them, such that the set can be undone with a single action.
|
* the ones that instantiated them, such that the set can be undone with a single action.
|
||||||
*/
|
*/
|
||||||
private _removeFootnote( modelWriter: Writer, footnote: ModelElement ) {
|
private _removeFootnote( modelWriter: ModelWriter, footnote: ModelElement ) {
|
||||||
// delete the current footnote and its references,
|
// delete the current footnote and its references,
|
||||||
// and renumber subsequent footnotes.
|
// and renumber subsequent footnotes.
|
||||||
if ( !this.editor ) {
|
if ( !this.editor ) {
|
||||||
@ -212,7 +212,7 @@ export default class FootnoteEditing extends Plugin {
|
|||||||
* all references are deleted. modelWriter is passed in to batch these changes with
|
* all references are deleted. modelWriter is passed in to batch these changes with
|
||||||
* the ones that instantiated them, such that the set can be undone with a single action.
|
* the ones that instantiated them, such that the set can be undone with a single action.
|
||||||
*/
|
*/
|
||||||
private _removeReferences( modelWriter: Writer, footnoteId: string | undefined = undefined ) {
|
private _removeReferences( modelWriter: ModelWriter, footnoteId: string | undefined = undefined ) {
|
||||||
const removeList: Array<any> = [];
|
const removeList: Array<any> = [];
|
||||||
if ( !this.rootElement ) {
|
if ( !this.rootElement ) {
|
||||||
throw new Error( 'Document has no root element.' );
|
throw new Error( 'Document has no root element.' );
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Command, type ModelElement, type ModelRootElement, type Writer } from "ckeditor5";
|
import { Command, type ModelElement, type ModelRootElement, type ModelWriter } from "ckeditor5";
|
||||||
|
|
||||||
import { ATTRIBUTES, ELEMENTS } from './constants.js';
|
import { ATTRIBUTES, ELEMENTS } from './constants.js';
|
||||||
import { modelQueryElement } from './utils.js';
|
import { modelQueryElement } from './utils.js';
|
||||||
@ -82,7 +82,7 @@ export default class InsertFootnoteCommand extends Command {
|
|||||||
/**
|
/**
|
||||||
* Returns the footnote section if it exists, or creates on if it doesn't.
|
* Returns the footnote section if it exists, or creates on if it doesn't.
|
||||||
*/
|
*/
|
||||||
private _getFootnoteSection( writer: Writer, rootElement: ModelRootElement ): ModelElement {
|
private _getFootnoteSection( writer: ModelWriter, rootElement: ModelRootElement ): ModelElement {
|
||||||
const footnoteSection = modelQueryElement( this.editor, rootElement, element =>
|
const footnoteSection = modelQueryElement( this.editor, rootElement, element =>
|
||||||
element.is( 'element', ELEMENTS.footnoteSection )
|
element.is( 'element', ELEMENTS.footnoteSection )
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user