Skip to content

Commit

Permalink
🐛 Bugfix: Fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nookery committed Dec 6, 2024
1 parent 0fd4957 commit aa40bb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/extensions/WebKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ const WebKit = TiptapExtension.create<{}, WebKitStorage>({
return
}

const nodeStore = this.editor.storage.nodeStore as NodeStoreStorage

// if (this.storage.verbose) {
// console.log(this.storage.emoji, 'onUpdate', nodeStore.article.flattened())
// }

if (!('webkit' in window)) {
return
}

const nodeStore = this.editor.storage.nodeStore as NodeStoreStorage

// Send Article
if (this.storage.sendArticle) {
var messageArticle = (new MessageSendArticle())
Expand Down
7 changes: 7 additions & 0 deletions src/model/EditorNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class EditorNode {
wordCount?: number
characterCount?: number
html?: string
text?: string
attrs?: Record<string, any> = undefined
type: string = 'unknown'
children?: EditorNode[] = []
Expand All @@ -27,6 +28,7 @@ class EditorNode {
.setType(json.type ?? "")
.setAttrs(json.attrs ?? {})
.setParentId(parentId)
.setText(json.text ?? undefined)

if (node.type == SmartText.name && !node.getParentId()) {
throw new EditorNodeNoParentIdError("Parent ID is not set", node)
Expand Down Expand Up @@ -141,6 +143,11 @@ class EditorNode {
public setParentId(parentId: string): EditorNode {
return this.setAttrs({ ...this.attrs, parentId });
}

public setText(text: string | undefined): EditorNode {
this.text = text
return this
}
}

function getTitle(json: JSONContent): string {
Expand Down

0 comments on commit aa40bb4

Please sign in to comment.