-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: make spanner plugin * feat: add config to spanner plugin * fix: linting errors * feat: config mountpoint * fix: unit test * refactor: bky helper * refactor: remove unused imports
- Loading branch information
1 parent
805c9b8
commit 274c1c7
Showing
12 changed files
with
71 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
type AttributesObject, | ||
type DataBaseNode, | ||
BlockDataElement, | ||
BlockyTextModel, | ||
} from "@pkg/data"; | ||
import { makeDefaultIdGenerator } from "./idHelper"; | ||
import Delta from "quill-delta-es"; | ||
|
||
export const bky = { | ||
idGenerator: makeDefaultIdGenerator(), | ||
text( | ||
attributes?: AttributesObject | Delta, | ||
children?: DataBaseNode[] | ||
): BlockDataElement { | ||
const newId = this.idGenerator.mkBlockId(); | ||
if (attributes instanceof Delta) { | ||
return new BlockDataElement("Text", newId, { | ||
textContent: new BlockyTextModel(attributes), | ||
}); | ||
} | ||
return new BlockDataElement("Text", newId, attributes, children); | ||
}, | ||
element( | ||
text: string, | ||
attributes?: AttributesObject, | ||
children?: DataBaseNode[] | ||
) { | ||
const newId = this.idGenerator.mkBlockId(); | ||
return new BlockDataElement(text, newId, attributes, children); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { test, expect } from "vitest"; | ||
import "@pkg/index"; | ||
import { BlockyDocument, BlockDataElement } from "@pkg/data"; | ||
import { TextBlock } from "@pkg/block/textBlock"; | ||
import { BlockyDocument } from "@pkg/data"; | ||
import { bky } from "@pkg/helper/bky"; | ||
|
||
test("block level 0", () => { | ||
const root = new BlockyDocument(); | ||
const firstElement = new BlockDataElement(TextBlock.Name, "id-1"); | ||
const firstElement = bky.text(); | ||
root.__insertChildAt(root.childrenLength, firstElement); | ||
expect(firstElement.blockLevel()).toBe(0); | ||
}); | ||
|
||
test("block level 1", () => { | ||
const root = new BlockyDocument(); | ||
const firstElement = new BlockDataElement(TextBlock.Name, "id-1"); | ||
const firstElement = bky.text(); | ||
root.__insertChildAt(root.childrenLength, firstElement); | ||
const childElement = new BlockDataElement(TextBlock.Name, "id-2"); | ||
const childElement = bky.text(); | ||
firstElement.__insertChildAt(firstElement.childrenLength, childElement); | ||
expect(childElement.blockLevel()).toBe(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
274c1c7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
blocky-editor – ./
blocky-editor-vincentdchan.vercel.app
blocky-editor.dev
blocky-editor.vercel.app
blocky-editor-git-master-vincentdchan.vercel.app
www.blocky-editor.dev