mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
chore(ckeditor5): fix references: Writer -> ModelWriter
This commit is contained in:
parent
abafa8c2d2
commit
b73da46111
@ -1,4 +1,4 @@
|
|||||||
import { Command, FileRepository, Model, type NodeAttributes, type Writer } from "ckeditor5";
|
import { Command, FileRepository, Model, type NodeAttributes, type ModelWriter } from "ckeditor5";
|
||||||
|
|
||||||
interface FileUploadOpts {
|
interface FileUploadOpts {
|
||||||
file: File[];
|
file: File[];
|
||||||
@ -34,7 +34,7 @@ export default class FileUploadCommand extends Command {
|
|||||||
/**
|
/**
|
||||||
* Handles uploading single file.
|
* Handles uploading single file.
|
||||||
*/
|
*/
|
||||||
function uploadFile( writer: Writer, model: Model, fileRepository: FileRepository, file: File ) {
|
function uploadFile( writer: ModelWriter, model: Model, fileRepository: FileRepository, file: File ) {
|
||||||
const loader = fileRepository.createLoader( file );
|
const loader = fileRepository.createLoader( file );
|
||||||
|
|
||||||
// Do not throw when upload adapter is not set. FileRepository will log an error anyway.
|
// Do not throw when upload adapter is not set. FileRepository will log an error anyway.
|
||||||
@ -45,7 +45,7 @@ function uploadFile( writer: Writer, model: Model, fileRepository: FileRepositor
|
|||||||
insertFileLink( writer, model, { href: '', uploadId: loader.id }, file );
|
insertFileLink( writer, model, { href: '', uploadId: loader.id }, file );
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertFileLink( writer: Writer, model: Model, attributes: NodeAttributes = {}, file: File ) {
|
function insertFileLink( writer: ModelWriter, model: Model, attributes: NodeAttributes = {}, file: File ) {
|
||||||
const placeholder = writer.createElement( 'reference', attributes );
|
const placeholder = writer.createElement( 'reference', attributes );
|
||||||
model.insertContent( placeholder, model.document.selection );
|
model.insertContent( placeholder, model.document.selection );
|
||||||
writer.insertText( ' ', placeholder, 'after' );
|
writer.insertText( ' ', placeholder, 'after' );
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { ModelElement, ModelPosition, Writer } from "ckeditor5";
|
import type { ModelElement, ModelPosition, ModelWriter } from "ckeditor5";
|
||||||
import type { ModelNode, Editor } from "ckeditor5";
|
import type { ModelNode, Editor } from "ckeditor5";
|
||||||
import { Plugin } from "ckeditor5";
|
import { Plugin } from "ckeditor5";
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ export default class SyntaxHighlighting extends Plugin {
|
|||||||
* the formatting would be stored with the note and it would need a
|
* the formatting would be stored with the note and it would need a
|
||||||
* way to remove that formatting when editing back the note.
|
* way to remove that formatting when editing back the note.
|
||||||
*/
|
*/
|
||||||
highlightCodeBlock(codeBlock: ModelElement, writer: Writer) {
|
highlightCodeBlock(codeBlock: ModelElement, writer: ModelWriter) {
|
||||||
log("highlighting codeblock " + JSON.stringify(codeBlock.toJSON()));
|
log("highlighting codeblock " + JSON.stringify(codeBlock.toJSON()));
|
||||||
const model = codeBlock.root.document?.model;
|
const model = codeBlock.root.document?.model;
|
||||||
if (!model) {
|
if (!model) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user