bookish-press 0.4.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/components/Auth.svelte +27 -24
- package/components/Auth.svelte.d.ts +4 -4
- package/components/Authentication.d.ts +2 -2
- package/components/BookPreview.svelte +75 -59
- package/components/BookPreview.svelte.d.ts +5 -5
- package/components/External.svelte +1 -1
- package/components/External.svelte.d.ts +3 -3
- package/components/Link.svelte +49 -3
- package/components/Link.svelte.d.ts +3 -4
- package/components/app/BookList.svelte +19 -0
- package/components/app/BookList.svelte.d.ts +18 -0
- package/components/app/Button.svelte +49 -0
- package/components/app/Button.svelte.d.ts +22 -0
- package/components/app/Feedback.svelte +47 -0
- package/components/app/Feedback.svelte.d.ts +18 -0
- package/components/app/Head.svelte +15 -0
- package/components/app/Head.svelte.d.ts +18 -0
- package/components/app/Large.svelte +8 -0
- package/components/app/Large.svelte.d.ts +27 -0
- package/components/app/Lead.svelte +12 -0
- package/components/app/Lead.svelte.d.ts +27 -0
- package/components/app/Link.svelte +24 -0
- package/components/app/Link.svelte.d.ts +20 -0
- package/components/app/Options.svelte +24 -0
- package/components/app/Options.svelte.d.ts +19 -0
- package/components/app/Paragraph.svelte +20 -0
- package/components/app/Paragraph.svelte.d.ts +18 -0
- package/components/app/Section.svelte +12 -0
- package/components/app/Section.svelte.d.ts +27 -0
- package/components/app/Table.svelte +32 -0
- package/components/app/Table.svelte.d.ts +27 -0
- package/components/app/TextInput.svelte +38 -0
- package/components/app/TextInput.svelte.d.ts +22 -0
- package/components/chapter/Atom.svelte +20 -6
- package/components/chapter/Atom.svelte.d.ts +3 -3
- package/components/chapter/Block.svelte +26 -21
- package/components/chapter/Block.svelte.d.ts +4 -4
- package/components/chapter/Callout.svelte +38 -7
- package/components/chapter/Callout.svelte.d.ts +4 -4
- package/components/chapter/CaptionedCode.svelte +67 -24
- package/components/chapter/CaptionedCode.svelte.d.ts +4 -4
- package/components/chapter/ChapterBody.svelte +62 -9
- package/components/chapter/ChapterBody.svelte.d.ts +5 -4
- package/components/chapter/Citations.svelte +86 -20
- package/components/chapter/Citations.svelte.d.ts +4 -4
- package/components/chapter/Code.svelte +152 -21
- package/components/chapter/Code.svelte.d.ts +3 -3
- package/components/chapter/Comment.svelte +39 -17
- package/components/chapter/Comment.svelte.d.ts +3 -3
- package/components/chapter/Definition.svelte +52 -18
- package/components/chapter/Definition.svelte.d.ts +5 -8
- package/components/chapter/Embed.svelte +155 -67
- package/components/chapter/Embed.svelte.d.ts +6 -4
- package/components/chapter/ErrorMessage.svelte +7 -2
- package/components/chapter/ErrorMessage.svelte.d.ts +4 -4
- package/components/chapter/ExtendedPrism.d.ts +2 -0
- package/components/chapter/ExtendedPrism.js +69 -0
- package/components/chapter/Figure.svelte +90 -0
- package/components/chapter/Figure.svelte.d.ts +24 -0
- package/components/chapter/Footnote.svelte +75 -12
- package/components/chapter/Footnote.svelte.d.ts +4 -4
- package/components/chapter/Format.svelte +63 -38
- package/components/chapter/Format.svelte.d.ts +5 -4
- package/components/chapter/InlineCode.svelte +16 -6
- package/components/chapter/InlineCode.svelte.d.ts +4 -4
- package/components/chapter/Label.svelte +38 -9
- package/components/chapter/Label.svelte.d.ts +4 -4
- package/components/chapter/Link.svelte +24 -19
- package/components/chapter/Link.svelte.d.ts +4 -4
- package/components/chapter/List.svelte +75 -8
- package/components/chapter/List.svelte.d.ts +4 -4
- package/components/chapter/Marginal.svelte +169 -27
- package/components/chapter/Marginal.svelte.d.ts +6 -3
- package/components/chapter/Paragraph.svelte +79 -6
- package/components/chapter/Paragraph.svelte.d.ts +4 -4
- package/components/chapter/Positioned.svelte +33 -0
- package/components/chapter/Positioned.svelte.d.ts +19 -0
- package/components/chapter/Problem.svelte +15 -0
- package/components/chapter/Problem.svelte.d.ts +27 -0
- package/components/chapter/Python.svelte +68 -21
- package/components/chapter/Python.svelte.d.ts +4 -4
- package/components/chapter/Quote.svelte +64 -11
- package/components/chapter/Quote.svelte.d.ts +4 -4
- package/components/chapter/Rule.svelte +12 -1
- package/components/chapter/Rule.svelte.d.ts +4 -4
- package/components/chapter/Table.svelte +36 -25
- package/components/chapter/Table.svelte.d.ts +4 -4
- package/components/chapter/Text.svelte +61 -36
- package/components/chapter/Text.svelte.d.ts +5 -4
- package/components/editor/BookishEditor.svelte +373 -244
- package/components/editor/BookishEditor.svelte.d.ts +9 -6
- package/components/editor/CalloutEditor.svelte +5 -5
- package/components/editor/CalloutEditor.svelte.d.ts +4 -4
- package/components/editor/CaptionedCodeEditor.svelte +16 -12
- package/components/editor/CaptionedCodeEditor.svelte.d.ts +4 -4
- package/components/editor/CaretContext.d.ts +48 -16
- package/components/editor/CaretState.d.ts +16 -44
- package/components/editor/CaretUtilities.d.ts +2 -2
- package/components/editor/CaretView.svelte +82 -0
- package/components/editor/CaretView.svelte.d.ts +25 -0
- package/components/editor/CitationsEditor.svelte +36 -25
- package/components/editor/CitationsEditor.svelte.d.ts +4 -4
- package/components/editor/Clipboard.d.ts +2 -2
- package/components/editor/Command.d.ts +13 -12
- package/components/editor/Commands.d.ts +1 -1
- package/components/editor/Commands.js +1114 -571
- package/components/editor/ConfirmButton.svelte +18 -12
- package/components/editor/ConfirmButton.svelte.d.ts +5 -4
- package/components/editor/DefinitionEditor.svelte +29 -21
- package/components/editor/DefinitionEditor.svelte.d.ts +4 -4
- package/components/editor/EmbedEditor.svelte +93 -43
- package/components/editor/EmbedEditor.svelte.d.ts +3 -3
- package/components/editor/Icon.svelte +17 -0
- package/components/editor/Icon.svelte.d.ts +16 -0
- package/components/editor/ImageChooser.svelte +53 -34
- package/components/editor/ImageChooser.svelte.d.ts +3 -3
- package/components/editor/InlineCodeEditor.svelte +7 -4
- package/components/editor/InlineCodeEditor.svelte.d.ts +4 -4
- package/components/editor/LabelEditor.svelte +20 -11
- package/components/editor/LabelEditor.svelte.d.ts +4 -4
- package/components/editor/LanguageEditor.svelte +10 -7
- package/components/editor/LanguageEditor.svelte.d.ts +3 -3
- package/components/editor/LinkEditor.svelte +64 -39
- package/components/editor/LinkEditor.svelte.d.ts +4 -4
- package/components/editor/Note.svelte +4 -3
- package/components/editor/Note.svelte.d.ts +6 -2
- package/components/editor/Permissions.svelte +95 -0
- package/components/editor/Permissions.svelte.d.ts +20 -0
- package/components/editor/PositionEditor.svelte +9 -6
- package/components/editor/PositionEditor.svelte.d.ts +4 -4
- package/components/editor/QuoteEditor.svelte +7 -2
- package/components/editor/QuoteEditor.svelte.d.ts +4 -4
- package/components/editor/Switch.svelte +55 -28
- package/components/editor/Switch.svelte.d.ts +4 -4
- package/components/editor/TableEditor.svelte +10 -0
- package/components/editor/TableEditor.svelte.d.ts +17 -0
- package/components/editor/TextEditor.svelte +83 -45
- package/components/editor/TextEditor.svelte.d.ts +5 -4
- package/components/editor/Toggle.svelte +11 -8
- package/components/editor/Toggle.svelte.d.ts +4 -4
- package/components/editor/Toolbar.svelte +191 -144
- package/components/editor/Toolbar.svelte.d.ts +5 -8
- package/components/editor/ToolbarGroup.svelte +17 -23
- package/components/editor/ToolbarGroup.svelte.d.ts +3 -4
- package/components/editor/ToolbarSpacer.svelte +8 -1
- package/components/editor/ToolbarSpacer.svelte.d.ts +6 -2
- package/components/editor/URLEditor.svelte +6 -8
- package/components/editor/URLEditor.svelte.d.ts +3 -3
- package/components/editor/UndoState.d.ts +3 -3
- package/components/editor/icons/annotate.svg +1 -0
- package/components/editor/icons/block.svg +1 -0
- package/components/editor/icons/bold.svg +1 -0
- package/components/editor/icons/bullets.svg +1 -0
- package/components/editor/icons/callout.svg +1 -0
- package/components/editor/icons/citation.svg +8 -0
- package/components/editor/icons/clear.svg +1 -0
- package/components/editor/icons/clipboard.svg +1 -0
- package/components/editor/icons/code.svg +1 -0
- package/components/editor/icons/columnafter.svg +1 -0
- package/components/editor/icons/columnbefore.svg +1 -0
- package/components/editor/icons/comment.svg +1 -0
- package/components/editor/icons/copy.svg +1 -0
- package/components/editor/icons/cut.svg +1 -0
- package/components/editor/icons/define.svg +7 -0
- package/components/editor/icons/deletecolumn.svg +1 -0
- package/components/editor/icons/deleterow.svg +1 -0
- package/components/editor/icons/footnote.svg +8 -0
- package/components/editor/icons/header1.svg +7 -0
- package/components/editor/icons/header2.svg +7 -0
- package/components/editor/icons/header3.svg +7 -0
- package/components/editor/icons/home.svg +1 -0
- package/components/editor/icons/indent.svg +1 -0
- package/components/editor/icons/italic.svg +1 -0
- package/components/editor/icons/label.svg +1 -0
- package/components/editor/icons/left.svg +1 -0
- package/components/editor/icons/level.svg +1 -0
- package/components/editor/icons/link.svg +1 -0
- package/components/editor/icons/list.svg +1 -0
- package/components/editor/icons/media.svg +1 -0
- package/components/editor/icons/middle.svg +1 -0
- package/components/editor/icons/numbers.svg +10 -0
- package/components/editor/icons/paragraph.svg +1 -0
- package/components/editor/icons/paste.svg +10 -0
- package/components/editor/icons/quote.svg +1 -0
- package/components/editor/icons/redo.svg +1 -0
- package/components/editor/icons/right.svg +1 -0
- package/components/editor/icons/rowabove.svg +1 -0
- package/components/editor/icons/rowbelow.svg +1 -0
- package/components/editor/icons/rule.svg +1 -0
- package/components/editor/icons/sub.svg +1 -0
- package/components/editor/icons/super.svg +1 -0
- package/components/editor/icons/table.svg +1 -0
- package/components/editor/icons/text.svg +1 -0
- package/components/editor/icons/time.svg +1 -0
- package/components/editor/icons/undo.svg +1 -0
- package/components/editor/icons/unindent.svg +1 -0
- package/components/editor/icons/unlink.svg +1 -0
- package/components/page/Acknowledgements.svelte +35 -24
- package/components/page/Acknowledgements.svelte.d.ts +4 -4
- package/components/page/Authors.svelte +34 -17
- package/components/page/Authors.svelte.d.ts +7 -6
- package/components/page/BookLoader.svelte +59 -0
- package/components/page/BookLoader.svelte.d.ts +16 -0
- package/components/page/BulkReferenceEditor.svelte +54 -23
- package/components/page/BulkReferenceEditor.svelte.d.ts +4 -4
- package/components/page/Chapter.svelte +234 -143
- package/components/page/Chapter.svelte.d.ts +3 -3
- package/components/page/ChapterContext.d.ts +4 -4
- package/components/page/ChapterNumber.svelte +9 -0
- package/components/page/ChapterNumber.svelte.d.ts +27 -0
- package/components/page/ChapterTitle.svelte +16 -0
- package/components/page/ChapterTitle.svelte.d.ts +18 -0
- package/components/page/Contexts.d.ts +42 -22
- package/components/page/Contexts.js +129 -17
- package/components/page/DefinitionView.svelte +129 -90
- package/components/page/DefinitionView.svelte.d.ts +3 -3
- package/components/page/Description.svelte +31 -19
- package/components/page/Description.svelte.d.ts +4 -4
- package/components/page/Edition.svelte +135 -80
- package/components/page/Edition.svelte.d.ts +5 -6
- package/components/page/EditionLoader.svelte +99 -0
- package/components/page/EditionLoader.svelte.d.ts +18 -0
- package/components/page/Editions.svelte +106 -0
- package/components/page/Editions.svelte.d.ts +14 -0
- package/components/page/Glossary.svelte +65 -49
- package/components/page/Glossary.svelte.d.ts +4 -4
- package/components/page/Header.svelte +143 -56
- package/components/page/Header.svelte.d.ts +8 -6
- package/components/page/Index.svelte +116 -80
- package/components/page/Index.svelte.d.ts +4 -4
- package/components/page/Instructions.svelte +18 -17
- package/components/page/Instructions.svelte.d.ts +6 -4
- package/components/page/License.svelte +39 -23
- package/components/page/License.svelte.d.ts +4 -4
- package/components/page/Loading.svelte +102 -12
- package/components/page/Loading.svelte.d.ts +6 -2
- package/components/page/Media.svelte +81 -53
- package/components/page/Media.svelte.d.ts +4 -4
- package/components/page/MediaPreview.svelte +26 -8
- package/components/page/MediaPreview.svelte.d.ts +3 -3
- package/components/page/Muted.svelte +10 -0
- package/components/page/Muted.svelte.d.ts +27 -0
- package/components/page/Outline.svelte +279 -59
- package/components/page/Outline.svelte.d.ts +3 -3
- package/components/page/Page.svelte +40 -9
- package/components/page/Page.svelte.d.ts +3 -3
- package/components/page/PageHeader.svelte +14 -0
- package/components/page/PageHeader.svelte.d.ts +18 -0
- package/components/page/PageParagraph.svelte +18 -0
- package/components/page/PageParagraph.svelte.d.ts +27 -0
- package/components/page/PossibleChapter.svelte +7 -7
- package/components/page/PossibleChapter.svelte.d.ts +4 -4
- package/components/page/PossibleReference.svelte +6 -11
- package/components/page/PossibleReference.svelte.d.ts +6 -7
- package/components/page/Print.svelte +27 -3
- package/components/page/Print.svelte.d.ts +4 -4
- package/components/page/Publish.svelte +134 -0
- package/components/page/Publish.svelte.d.ts +14 -0
- package/components/page/Reference.svelte +259 -117
- package/components/page/Reference.svelte.d.ts +5 -5
- package/components/page/References.svelte +45 -48
- package/components/page/References.svelte.d.ts +4 -4
- package/components/page/Rows.svelte +54 -0
- package/components/page/Rows.svelte.d.ts +27 -0
- package/components/page/Search.svelte +88 -63
- package/components/page/Search.svelte.d.ts +4 -4
- package/components/page/Status.svelte +46 -39
- package/components/page/Status.svelte.d.ts +4 -9
- package/components/page/SubdomainEditor.svelte +41 -27
- package/components/page/SubdomainEditor.svelte.d.ts +4 -4
- package/components/page/TableOfContents.svelte +264 -191
- package/components/page/TableOfContents.svelte.d.ts +4 -4
- package/components/page/TableOfContentsImage.svelte +8 -8
- package/components/page/TableOfContentsImage.svelte.d.ts +3 -3
- package/components/page/TableOfContentsRow.svelte +97 -34
- package/components/page/TableOfContentsRow.svelte.d.ts +4 -4
- package/components/page/ThemeEditor.svelte +177 -39
- package/components/page/ThemeEditor.svelte.d.ts +4 -4
- package/components/page/ThemeEditorPreview.svelte +35 -23
- package/components/page/ThemeEditorPreview.svelte.d.ts +5 -5
- package/components/page/ThemeSetEditor.svelte +15 -13
- package/components/page/ThemeSetEditor.svelte.d.ts +4 -4
- package/components/page/ThemeVariableEditor.svelte +24 -15
- package/components/page/ThemeVariableEditor.svelte.d.ts +3 -3
- package/components/page/Title.svelte +12 -0
- package/components/page/Title.svelte.d.ts +27 -0
- package/components/page/Unknown.svelte +28 -21
- package/components/page/Unknown.svelte.d.ts +4 -4
- package/components/page/margins.js +50 -33
- package/index.d.ts +13 -0
- package/index.js +14 -0
- package/models/CRUD.d.ts +27 -0
- package/models/CRUD.js +262 -0
- package/models/Firebase.d.ts +1 -0
- package/models/Firebase.js +26 -16
- package/models/book/Book.d.ts +40 -39
- package/models/book/Book.js +121 -121
- package/models/book/BookMedia.d.ts +3 -3
- package/models/book/BookMedia.js +22 -16
- package/models/book/BookSaveStatus.d.ts +7 -0
- package/models/book/BookSaveStatus.js +8 -0
- package/models/book/Chapter.d.ts +50 -39
- package/models/book/Chapter.js +189 -198
- package/models/book/ChapterID.js +7 -7
- package/models/book/Definition.d.ts +1 -1
- package/models/book/Edition.d.ts +87 -61
- package/models/book/Edition.js +460 -309
- package/models/book/Reference.d.ts +24 -0
- package/models/book/Reference.js +78 -0
- package/models/book/Schema.d.ts +168 -0
- package/models/book/Schema.js +115 -0
- package/models/book/Theme.d.ts +44 -37
- package/models/book/Theme.js +452 -52
- package/models/book/ThemeColors.d.ts +1 -1
- package/models/book/Words.d.ts +2 -0
- package/models/book/Words.js +110 -0
- package/models/chapter/AtomNode.d.ts +4 -4
- package/models/chapter/AtomNode.js +20 -13
- package/models/chapter/BlockNode.d.ts +9 -10
- package/models/chapter/BlockNode.js +32 -13
- package/models/chapter/BlocksNode.d.ts +10 -10
- package/models/chapter/BlocksNode.js +315 -120
- package/models/chapter/BlocksNode.test.js +494 -228
- package/models/chapter/Bookkeeping.d.ts +1 -1
- package/models/chapter/CalloutNode.d.ts +3 -3
- package/models/chapter/CalloutNode.js +34 -12
- package/models/chapter/Caret.d.ts +9 -7
- package/models/chapter/Caret.js +11 -6
- package/models/chapter/ChapterNode.d.ts +11 -11
- package/models/chapter/ChapterNode.js +70 -33
- package/models/chapter/CitationsNode.d.ts +3 -3
- package/models/chapter/CitationsNode.js +31 -12
- package/models/chapter/CodeNode.d.ts +11 -6
- package/models/chapter/CodeNode.js +143 -34
- package/models/chapter/CommentNode.d.ts +5 -5
- package/models/chapter/CommentNode.js +29 -13
- package/models/chapter/DefinitionNode.d.ts +2 -2
- package/models/chapter/DefinitionNode.js +15 -7
- package/models/chapter/Edit.d.ts +3 -3
- package/models/chapter/EmbedNode.d.ts +9 -5
- package/models/chapter/EmbedNode.js +108 -35
- package/models/chapter/ErrorNode.d.ts +2 -2
- package/models/chapter/ErrorNode.js +34 -12
- package/models/chapter/FootnoteNode.d.ts +5 -5
- package/models/chapter/FootnoteNode.js +34 -16
- package/models/chapter/FormatNode.d.ts +10 -10
- package/models/chapter/FormatNode.js +237 -106
- package/models/chapter/FormatNode.test.js +87 -45
- package/models/chapter/InlineCodeNode.d.ts +2 -2
- package/models/chapter/InlineCodeNode.js +22 -9
- package/models/chapter/LabelNode.d.ts +4 -4
- package/models/chapter/LabelNode.js +31 -13
- package/models/chapter/LinkNode.d.ts +2 -2
- package/models/chapter/LinkNode.js +21 -9
- package/models/chapter/ListNode.d.ts +8 -8
- package/models/chapter/ListNode.js +99 -38
- package/models/chapter/ListNode.test.js +29 -24
- package/models/chapter/MetadataNode.d.ts +3 -3
- package/models/chapter/MetadataNode.js +13 -5
- package/models/chapter/Node.d.ts +5 -3
- package/models/chapter/Node.js +76 -29
- package/models/chapter/Node.test.js +20 -18
- package/models/chapter/ParagraphNode.d.ts +6 -6
- package/models/chapter/ParagraphNode.js +84 -29
- package/models/chapter/ParagraphNode.test.js +22 -13
- package/models/chapter/Parser.d.ts +27 -27
- package/models/chapter/Parser.js +220 -206
- package/models/chapter/Parser.test.js +16 -16
- package/models/chapter/Position.d.ts +1 -1
- package/models/chapter/QuoteNode.d.ts +6 -6
- package/models/chapter/QuoteNode.js +61 -23
- package/models/chapter/RootNode.d.ts +4 -4
- package/models/chapter/RuleNode.d.ts +2 -2
- package/models/chapter/RuleNode.js +31 -11
- package/models/chapter/TableNode.d.ts +8 -6
- package/models/chapter/TableNode.js +89 -34
- package/models/chapter/TableNode.test.js +22 -24
- package/models/chapter/TextNode.d.ts +6 -6
- package/models/chapter/TextNode.js +72 -32
- package/models/chapter/TextNode.test.js +4 -4
- package/package.json +108 -26
- package/util/getSubdomain.js +8 -6
- package/util/isMobile.js +1 -1
- package/util/mineReference.d.ts +3 -2
- package/util/mineReference.js +67 -29
- package/util/scrollToEyeLevel.js +6 -1
- package/components/chapter/renderPosition.d.ts +0 -3
- package/components/chapter/renderPosition.js +0 -4
- package/components/editor/ToolbarIcon.svelte +0 -22
- package/components/editor/ToolbarIcon.svelte.d.ts +0 -16
- package/components/page/Alert.svelte +0 -11
- package/components/page/Alert.svelte.d.ts +0 -23
- package/components/page/Revisions.svelte +0 -124
- package/components/page/Revisions.svelte.d.ts +0 -14
- package/models/BookLoader.d.ts +0 -2
- package/models/BookLoader.js +0 -67
- package/models/Firestore.d.ts +0 -22
- package/models/Firestore.js +0 -194
- package/models/chapter/ReferenceNode.d.ts +0 -29
- package/models/chapter/ReferenceNode.js +0 -48
- package/models/loadEdition.d.ts +0 -5
- package/models/loadEdition.js +0 -16
|
@@ -1,63 +1,81 @@
|
|
|
1
|
-
<script>import commands from
|
|
2
|
-
import TextNode from
|
|
3
|
-
import AtomNode from
|
|
4
|
-
import LinkNode from
|
|
5
|
-
import LabelNode from
|
|
6
|
-
import InlineCodeNode from
|
|
7
|
-
import CitationsNode from
|
|
8
|
-
import DefinitionNode from
|
|
9
|
-
import CodeNode from
|
|
10
|
-
import CalloutNode from
|
|
11
|
-
import EmbedNode from
|
|
12
|
-
import QuoteNode from
|
|
13
|
-
import LabelEditor from
|
|
14
|
-
import InlineCodeEditor from
|
|
15
|
-
import CitationsEditor from
|
|
16
|
-
import LinkEditor from
|
|
17
|
-
import DefinitionEditor from
|
|
18
|
-
import CaptionedCodeEditor from
|
|
19
|
-
import CalloutEditor from
|
|
20
|
-
import QuoteEditor from
|
|
21
|
-
import EmbedEditor from
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
1
|
+
<script>import commands from './Commands';
|
|
2
|
+
import TextNode from '../../models/chapter/TextNode';
|
|
3
|
+
import AtomNode from '../../models/chapter/AtomNode';
|
|
4
|
+
import LinkNode from '../../models/chapter/LinkNode';
|
|
5
|
+
import LabelNode from '../../models/chapter/LabelNode';
|
|
6
|
+
import InlineCodeNode from '../../models/chapter/InlineCodeNode';
|
|
7
|
+
import CitationsNode from '../../models/chapter/CitationsNode';
|
|
8
|
+
import DefinitionNode from '../../models/chapter/DefinitionNode';
|
|
9
|
+
import CodeNode from '../../models/chapter/CodeNode';
|
|
10
|
+
import CalloutNode from '../../models/chapter/CalloutNode';
|
|
11
|
+
import EmbedNode from '../../models/chapter/EmbedNode';
|
|
12
|
+
import QuoteNode from '../../models/chapter/QuoteNode';
|
|
13
|
+
import LabelEditor from './LabelEditor.svelte';
|
|
14
|
+
import InlineCodeEditor from './InlineCodeEditor.svelte';
|
|
15
|
+
import CitationsEditor from './CitationsEditor.svelte';
|
|
16
|
+
import LinkEditor from './LinkEditor.svelte';
|
|
17
|
+
import DefinitionEditor from './DefinitionEditor.svelte';
|
|
18
|
+
import CaptionedCodeEditor from './CaptionedCodeEditor.svelte';
|
|
19
|
+
import CalloutEditor from './CalloutEditor.svelte';
|
|
20
|
+
import QuoteEditor from './QuoteEditor.svelte';
|
|
21
|
+
import EmbedEditor from './EmbedEditor.svelte';
|
|
22
|
+
import TableEditor from './TableEditor.svelte';
|
|
23
|
+
import ToolbarGroup from './ToolbarGroup.svelte';
|
|
24
|
+
import Icon from './Icon.svelte';
|
|
25
|
+
import Button from '../app/Button.svelte';
|
|
26
|
+
import AnnotateIcon from './icons/annotate.svg?raw';
|
|
27
|
+
import BlockIcon from './icons/block.svg?raw';
|
|
28
|
+
import ClipboardIcon from './icons/clipboard.svg?raw';
|
|
29
|
+
import LevelIcon from './icons/level.svg?raw';
|
|
30
|
+
import ListIcon from './icons/list.svg?raw';
|
|
31
|
+
import TextIcon from './icons/text.svg?raw';
|
|
32
|
+
import TimeIcon from './icons/time.svg?raw';
|
|
33
|
+
import TableIcon from './icons/table.svg?raw';
|
|
34
|
+
import LinkIcon from './icons/link.svg?raw';
|
|
35
|
+
import LabelIcon from './icons/label.svg?raw';
|
|
36
|
+
import CitationIcon from './icons/citation.svg?raw';
|
|
37
|
+
import DefineIcon from './icons/define.svg?raw';
|
|
38
|
+
import CodeIcon from './icons/code.svg?raw';
|
|
39
|
+
import CalloutIcon from './icons/callout.svg?raw';
|
|
40
|
+
import QuoteIcon from './icons/quote.svg?raw';
|
|
41
|
+
import MediaIcon from './icons/media.svg?raw';
|
|
42
|
+
import TableNode from '../../models/chapter/TableNode';
|
|
43
|
+
import { slide } from 'svelte/transition';
|
|
25
44
|
const keyLabels = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
Digit0: '0',
|
|
46
|
+
Digit1: '1',
|
|
47
|
+
Digit2: '2',
|
|
48
|
+
Digit3: '3',
|
|
49
|
+
ArrowDown: '↓',
|
|
50
|
+
ArrowUp: '↑',
|
|
51
|
+
ArrowLeft: '←',
|
|
52
|
+
ArrowRight: '→',
|
|
53
|
+
Backspace: '\u232B',
|
|
35
54
|
};
|
|
36
55
|
const categoryOrder = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
navigation: 1,
|
|
57
|
+
selection: 2,
|
|
58
|
+
text: 3,
|
|
59
|
+
clipboard: 4,
|
|
60
|
+
annotation: 5,
|
|
61
|
+
paragraph: 6,
|
|
62
|
+
level: 7,
|
|
63
|
+
list: 8,
|
|
64
|
+
table: 9,
|
|
65
|
+
block: 10,
|
|
47
66
|
};
|
|
48
67
|
const categoryIcons = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
text: TextIcon,
|
|
69
|
+
clipboard: ClipboardIcon,
|
|
70
|
+
annotation: AnnotateIcon,
|
|
71
|
+
level: LevelIcon,
|
|
72
|
+
block: BlockIcon,
|
|
73
|
+
list: ListIcon,
|
|
74
|
+
table: TableIcon,
|
|
75
|
+
history: TimeIcon,
|
|
57
76
|
};
|
|
58
|
-
export let
|
|
59
|
-
|
|
60
|
-
export let visible = false;
|
|
77
|
+
export let caret;
|
|
78
|
+
$: context = caret.context;
|
|
61
79
|
$: chapter = context?.root;
|
|
62
80
|
let element = null;
|
|
63
81
|
let categories = undefined;
|
|
@@ -66,57 +84,63 @@ let metaNode = undefined;
|
|
|
66
84
|
let calloutNode = undefined;
|
|
67
85
|
let quoteNode = undefined;
|
|
68
86
|
let embedNode = undefined;
|
|
69
|
-
|
|
70
|
-
// Listen to focus changes to decide whether the toolbar is visible.
|
|
71
|
-
onMount(() => {
|
|
72
|
-
window.addEventListener("focus", updateVisible);
|
|
73
|
-
window.addEventListener("blur", updateVisible);
|
|
74
|
-
return () => {
|
|
75
|
-
window.removeEventListener("focus", updateVisible);
|
|
76
|
-
window.removeEventListener("blur", updateVisible);
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
function containsFocus() { return element !== null && element.contains(document.activeElement); }
|
|
80
|
-
function updateVisible() {
|
|
81
|
-
isVisible = visible || containsFocus();
|
|
82
|
-
}
|
|
87
|
+
let tableNode = undefined;
|
|
83
88
|
function getShortcutDescription(command) {
|
|
84
|
-
const macOS = navigator.
|
|
85
|
-
const controlSymbol = macOS ?
|
|
86
|
-
const altSymbol = macOS ?
|
|
87
|
-
const key = command.key
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
const macOS = navigator.userAgent.indexOf('Mac') >= 0;
|
|
90
|
+
const controlSymbol = macOS ? '\u2318' : 'Ctrl+';
|
|
91
|
+
const altSymbol = macOS ? '\u2325' : 'Alt+';
|
|
92
|
+
const key = command.key
|
|
93
|
+
? Array.isArray(command.key)
|
|
94
|
+
? command.key.join('/')
|
|
95
|
+
: command.key
|
|
96
|
+
: command.code
|
|
97
|
+
? command.code
|
|
98
|
+
: 'any';
|
|
99
|
+
const keyLabel = (typeof key === 'string'
|
|
100
|
+
? key in keyLabels
|
|
101
|
+
? keyLabels[key]
|
|
102
|
+
: key
|
|
103
|
+
: '—').toLocaleUpperCase();
|
|
104
|
+
return `${command.control ? controlSymbol : ''}${command.alt ? altSymbol : ''}${command.shift ? '\u21E7' : ''}${keyLabel}`;
|
|
90
105
|
}
|
|
91
106
|
// Update the above when the dependencies below change.
|
|
92
107
|
$: {
|
|
93
108
|
if (context !== undefined && chapter) {
|
|
94
109
|
// Filter the commands by those interactive with a mouse and active.
|
|
95
|
-
const visible = commands.filter(command => command.visible === true ||
|
|
110
|
+
const visible = commands.filter((command) => command.visible === true ||
|
|
111
|
+
(context &&
|
|
112
|
+
command.visible instanceof Function &&
|
|
113
|
+
command.visible(context)));
|
|
96
114
|
// Extract the active categories and sort them
|
|
97
|
-
categories =
|
|
98
|
-
|
|
99
|
-
|
|
115
|
+
categories = Array.from(new Set(commands.map((command) => command.category))).sort((a, b) => a in categoryOrder && b in categoryOrder
|
|
116
|
+
? categoryOrder[a] - categoryOrder[b]
|
|
117
|
+
: 0);
|
|
100
118
|
// Make a list for each category of commands
|
|
101
119
|
commandsByCategory = {};
|
|
102
|
-
categories.forEach(cat => {
|
|
120
|
+
categories.forEach((cat) => {
|
|
103
121
|
if (commandsByCategory)
|
|
104
|
-
commandsByCategory[cat] = visible.filter(command => command.category === cat);
|
|
122
|
+
commandsByCategory[cat] = visible.filter((command) => command.category === cat);
|
|
105
123
|
});
|
|
106
124
|
const caretNode = context.start.node;
|
|
107
125
|
metaNode =
|
|
108
|
-
caretNode instanceof AtomNode
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
126
|
+
caretNode instanceof AtomNode
|
|
127
|
+
? caretNode
|
|
128
|
+
: caretNode instanceof TextNode
|
|
129
|
+
? caretNode.getParent(chapter)
|
|
130
|
+
: undefined;
|
|
131
|
+
calloutNode = caretNode.getClosestParentMatching(chapter, (p) => p instanceof CalloutNode);
|
|
132
|
+
quoteNode = caretNode.getClosestParentMatching(chapter, (p) => p instanceof QuoteNode);
|
|
133
|
+
embedNode =
|
|
134
|
+
caretNode instanceof EmbedNode
|
|
135
|
+
? caretNode
|
|
136
|
+
: caretNode.getClosestParentMatching(chapter, (p) => p instanceof EmbedNode);
|
|
137
|
+
tableNode = caretNode.getClosestParentMatching(chapter, (p) => p instanceof TableNode);
|
|
114
138
|
}
|
|
115
139
|
}
|
|
116
140
|
function handleKeyPress(event) {
|
|
117
141
|
// Return focus to the editor if someone presses an unhandled enter
|
|
118
|
-
if (event.key ===
|
|
119
|
-
const editor = element.closest(
|
|
142
|
+
if ((event.key === 'Escape' || event.key === 'Enter') && element) {
|
|
143
|
+
const editor = element.closest('.bookish-editor');
|
|
120
144
|
if (editor instanceof HTMLElement) {
|
|
121
145
|
event.stopPropagation();
|
|
122
146
|
editor.focus();
|
|
@@ -127,76 +151,99 @@ function handleKeyPress(event) {
|
|
|
127
151
|
</script>
|
|
128
152
|
|
|
129
153
|
{#if chapter}
|
|
130
|
-
<section
|
|
131
|
-
class="bookish-editor-toolbar"
|
|
132
|
-
on:keypress={handleKeyPress}
|
|
133
|
-
style={`margin: ${isVisible ? "0px" : "-20em"};`}
|
|
154
|
+
<section
|
|
155
|
+
class="bookish-editor-toolbar"
|
|
134
156
|
bind:this={element}
|
|
135
|
-
on:
|
|
136
|
-
|
|
157
|
+
on:keypress={handleKeyPress}
|
|
158
|
+
on:keydown={handleKeyPress}
|
|
159
|
+
on:mousedown|stopPropagation={() => element?.focus()}
|
|
160
|
+
tabIndex="0"
|
|
161
|
+
transition:slide={{ duration: 200 }}
|
|
137
162
|
>
|
|
138
|
-
{#if context && categories
|
|
139
|
-
{#each categories as cat
|
|
140
|
-
{#if commandsByCategory[cat].length > 0
|
|
141
|
-
<ToolbarGroup
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
{#if context && categories}
|
|
164
|
+
{#each categories as cat}
|
|
165
|
+
{#if commandsByCategory[cat].length > 0}
|
|
166
|
+
<ToolbarGroup
|
|
167
|
+
icon={cat in categoryIcons
|
|
168
|
+
? categoryIcons[cat]
|
|
169
|
+
: cat.charAt(0).toUpperCase() + cat.slice(1)}
|
|
170
|
+
>
|
|
171
|
+
{#each commandsByCategory[cat] as command}
|
|
172
|
+
<Button
|
|
173
|
+
disabled={command.active === false ||
|
|
174
|
+
(command.active instanceof Function &&
|
|
175
|
+
command.active.call(
|
|
176
|
+
undefined,
|
|
177
|
+
context
|
|
178
|
+
) === false)}
|
|
179
|
+
tooltip={command.description +
|
|
180
|
+
' ' +
|
|
181
|
+
getShortcutDescription(command)}
|
|
182
|
+
tabIndex="0"
|
|
183
|
+
command={() =>
|
|
184
|
+
caret?.executor.call(
|
|
185
|
+
undefined,
|
|
186
|
+
command,
|
|
187
|
+
''
|
|
188
|
+
)}
|
|
149
189
|
>
|
|
150
|
-
{
|
|
151
|
-
|
|
152
|
-
{:else if command.label }
|
|
153
|
-
{command.label}
|
|
154
|
-
{:else}
|
|
155
|
-
{command.description }
|
|
156
|
-
{/if}
|
|
157
|
-
</button>
|
|
190
|
+
<Icon icon={command.icon} />
|
|
191
|
+
</Button>
|
|
158
192
|
{/each}
|
|
193
|
+
{#if cat === 'table' && tableNode}
|
|
194
|
+
<TableEditor table={tableNode} />
|
|
195
|
+
{/if}
|
|
159
196
|
</ToolbarGroup>
|
|
160
197
|
{/if}
|
|
161
198
|
{/each}
|
|
162
199
|
{/if}
|
|
163
|
-
{#if metaNode instanceof LinkNode}<ToolbarGroup icon=
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
200
|
+
{#if metaNode instanceof LinkNode}<ToolbarGroup icon={LinkIcon}
|
|
201
|
+
><LinkEditor link={metaNode} /></ToolbarGroup
|
|
202
|
+
>
|
|
203
|
+
{:else if metaNode instanceof LabelNode}<ToolbarGroup icon={LabelIcon}
|
|
204
|
+
><LabelEditor label={metaNode} /></ToolbarGroup
|
|
205
|
+
>
|
|
206
|
+
{:else if metaNode instanceof InlineCodeNode}<ToolbarGroup
|
|
207
|
+
icon={CodeIcon}
|
|
208
|
+
><InlineCodeEditor code={metaNode} /></ToolbarGroup
|
|
209
|
+
>
|
|
210
|
+
{:else if metaNode instanceof CitationsNode}<ToolbarGroup
|
|
211
|
+
icon={CitationIcon}
|
|
212
|
+
><CitationsEditor citations={metaNode} /></ToolbarGroup
|
|
213
|
+
>
|
|
214
|
+
{:else if metaNode instanceof DefinitionNode}<ToolbarGroup
|
|
215
|
+
icon={DefineIcon}
|
|
216
|
+
><DefinitionEditor definition={metaNode} /></ToolbarGroup
|
|
217
|
+
>
|
|
218
|
+
{:else if metaNode instanceof CodeNode && context}<ToolbarGroup
|
|
219
|
+
icon={CodeIcon}
|
|
220
|
+
><CaptionedCodeEditor code={metaNode} /></ToolbarGroup
|
|
221
|
+
>
|
|
222
|
+
{:else if calloutNode}<ToolbarGroup icon={CalloutIcon}
|
|
223
|
+
><CalloutEditor callout={calloutNode} /></ToolbarGroup
|
|
224
|
+
>
|
|
225
|
+
{:else if quoteNode}<ToolbarGroup icon={QuoteIcon}
|
|
226
|
+
><QuoteEditor quote={quoteNode} /></ToolbarGroup
|
|
227
|
+
>
|
|
228
|
+
{:else if embedNode}<ToolbarGroup icon={MediaIcon}
|
|
229
|
+
><EmbedEditor embed={embedNode} /></ToolbarGroup
|
|
230
|
+
>
|
|
231
|
+
{/if}
|
|
172
232
|
</section>
|
|
173
233
|
{/if}
|
|
174
234
|
|
|
175
235
|
<style>
|
|
176
|
-
|
|
177
236
|
.bookish-editor-toolbar {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: row;
|
|
239
|
+
flex-wrap: wrap;
|
|
240
|
+
align-items: baseline;
|
|
182
241
|
background: var(--bookish-background-color);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
font-family: var(--bookish-app-chrome-font-family);
|
|
186
|
-
font-size: var(--bookish-app-chrome-font-size);
|
|
187
|
-
z-index: 2;
|
|
188
|
-
transition: top 1s;
|
|
242
|
+
font-family: var(--app-font);
|
|
243
|
+
font-size: var(--app-chrome-font-size);
|
|
189
244
|
}
|
|
190
245
|
|
|
191
|
-
.bookish-editor-toolbar
|
|
192
|
-
|
|
193
|
-
height: 1em;
|
|
246
|
+
.bookish-editor-toolbar:focus {
|
|
247
|
+
outline: 2px solid var(--app-interactive-color);
|
|
194
248
|
}
|
|
195
|
-
|
|
196
|
-
.bookish-editor-toolbar :global(hr) {
|
|
197
|
-
margin-top: var(--bookish-app-chrome-padding);
|
|
198
|
-
margin-bottom: var(--bookish-app-chrome-padding);
|
|
199
|
-
line-height: 1em;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
</style>
|
|
249
|
+
</style>
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type
|
|
3
|
-
import type CaretState from "./CaretState";
|
|
2
|
+
import type CaretState from './CaretState';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: {
|
|
6
|
-
|
|
7
|
-
executor?: ((command: Command, key: string) => void) | undefined;
|
|
8
|
-
visible?: boolean | undefined;
|
|
5
|
+
caret: CaretState;
|
|
9
6
|
};
|
|
10
7
|
events: {
|
|
11
8
|
[evt: string]: CustomEvent<any>;
|
|
12
9
|
};
|
|
13
10
|
slots: {};
|
|
14
11
|
};
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
12
|
+
export type ToolbarProps = typeof __propDef.props;
|
|
13
|
+
export type ToolbarEvents = typeof __propDef.events;
|
|
14
|
+
export type ToolbarSlots = typeof __propDef.slots;
|
|
18
15
|
export default class Toolbar extends SvelteComponentTyped<ToolbarProps, ToolbarEvents, ToolbarSlots> {
|
|
19
16
|
}
|
|
20
17
|
export {};
|
|
@@ -1,41 +1,35 @@
|
|
|
1
|
-
<script>import ToolbarIcon from
|
|
2
|
-
|
|
1
|
+
<script>import ToolbarIcon from './Icon.svelte';
|
|
2
|
+
import ToolbarSpacer from './ToolbarSpacer.svelte';
|
|
3
3
|
export let icon;
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
</span>
|
|
6
|
+
<div class="toolbar-group">
|
|
7
|
+
<ToolbarIcon {icon} /><ToolbarSpacer /><slot />
|
|
8
|
+
</div>
|
|
10
9
|
|
|
11
10
|
<style>
|
|
12
|
-
.
|
|
11
|
+
.toolbar-group {
|
|
13
12
|
display: inline-block;
|
|
14
|
-
margin-right: calc(2 * var(--
|
|
15
|
-
margin-bottom: var(--bookish-app-chrome-padding);
|
|
13
|
+
margin-right: calc(2 * var(--app-chrome-padding));
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
.
|
|
19
|
-
vertical-align: middle;
|
|
20
|
-
height: 2.25em;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.bookish-editor-toolbar-group :global(button:first-of-type) {
|
|
16
|
+
.toolbar-group :global(button:first-of-type) {
|
|
24
17
|
border-top-right-radius: 0;
|
|
18
|
+
border-bottom-right-radius: 0;
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
.
|
|
21
|
+
.toolbar-group :global(button:last-of-type) {
|
|
28
22
|
border-bottom-left-radius: 0;
|
|
23
|
+
border-top-left-radius: 0;
|
|
29
24
|
}
|
|
30
25
|
|
|
31
|
-
.
|
|
26
|
+
.toolbar-group :global(button:not(:first-of-type):not(:last-of-type)) {
|
|
32
27
|
border-radius: 0;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
.
|
|
36
|
-
.
|
|
37
|
-
margin-left: var(--
|
|
38
|
-
margin-right: var(--
|
|
30
|
+
.toolbar-group :global(input),
|
|
31
|
+
.toolbar-group :global(select) {
|
|
32
|
+
margin-left: var(--app-chrome-padding);
|
|
33
|
+
margin-right: var(--app-chrome-padding);
|
|
39
34
|
}
|
|
40
|
-
|
|
41
|
-
</style>
|
|
35
|
+
</style>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
linebreak?: boolean | undefined;
|
|
5
4
|
icon: string;
|
|
6
5
|
};
|
|
7
6
|
events: {
|
|
@@ -11,9 +10,9 @@ declare const __propDef: {
|
|
|
11
10
|
default: {};
|
|
12
11
|
};
|
|
13
12
|
};
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
13
|
+
export type ToolbarGroupProps = typeof __propDef.props;
|
|
14
|
+
export type ToolbarGroupEvents = typeof __propDef.events;
|
|
15
|
+
export type ToolbarGroupSlots = typeof __propDef.slots;
|
|
17
16
|
export default class ToolbarGroup extends SvelteComponentTyped<ToolbarGroupProps, ToolbarGroupEvents, ToolbarGroupSlots> {
|
|
18
17
|
}
|
|
19
18
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} ToolbarSpacerProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} ToolbarSpacerEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ToolbarSpacerSlots */
|
|
4
|
-
export default class ToolbarSpacer extends SvelteComponentTyped<{
|
|
4
|
+
export default class ToolbarSpacer extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
5
7
|
[evt: string]: CustomEvent<any>;
|
|
6
8
|
}, {}> {
|
|
7
9
|
}
|
|
@@ -10,7 +12,9 @@ export type ToolbarSpacerEvents = typeof __propDef.events;
|
|
|
10
12
|
export type ToolbarSpacerSlots = typeof __propDef.slots;
|
|
11
13
|
import { SvelteComponentTyped } from "svelte";
|
|
12
14
|
declare const __propDef: {
|
|
13
|
-
props: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
14
18
|
events: {
|
|
15
19
|
[evt: string]: CustomEvent<any>;
|
|
16
20
|
};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
<script>import TextEditor from
|
|
1
|
+
<script>import TextEditor from './TextEditor.svelte';
|
|
2
2
|
export let url;
|
|
3
3
|
export let validator;
|
|
4
4
|
export let edit;
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<TextEditor
|
|
8
|
-
placeholder="url"
|
|
9
|
-
|
|
8
|
+
placeholder="url"
|
|
9
|
+
text={url}
|
|
10
10
|
label="URL editor"
|
|
11
|
-
valid={
|
|
12
|
-
save={
|
|
13
|
-
|
|
14
|
-
clip={true}
|
|
15
|
-
/>
|
|
11
|
+
valid={(url) => validator(url)}
|
|
12
|
+
save={(url) => edit(url)}
|
|
13
|
+
/>
|
|
@@ -10,9 +10,9 @@ declare const __propDef: {
|
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
13
|
+
export type UrlEditorProps = typeof __propDef.props;
|
|
14
|
+
export type UrlEditorEvents = typeof __propDef.events;
|
|
15
|
+
export type UrlEditorSlots = typeof __propDef.slots;
|
|
16
16
|
export default class UrlEditor extends SvelteComponentTyped<UrlEditorProps, UrlEditorEvents, UrlEditorSlots> {
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IndexRange } from
|
|
2
|
-
import type Command from
|
|
3
|
-
|
|
1
|
+
import type { IndexRange } from '../../models/chapter/Caret';
|
|
2
|
+
import type Command from './Command';
|
|
3
|
+
type UndoState = {
|
|
4
4
|
command: Command | undefined;
|
|
5
5
|
bookdown: string;
|
|
6
6
|
range: IndexRange;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g><path d="M7.5,9l-3,.54L5,6.5,10.73.79a1,1,0,0,1,1.42,0l1.06,1.06a1,1,0,0,1,0,1.42Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12,9.5v3a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1V3a1,1,0,0,1,1-1h3" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g><line x1="13.5" y1="1" x2="8" y2="1" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><line x1="13.5" y1="4" x2="8" y2="4" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><line x1="13.5" y1="7" x2="8" y2="7" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><line x1="13.5" y1="13" x2="8" y2="13" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><line x1="13.5" y1="10" x2="8" y2="10" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><rect x="0.5" y="1" width="5" height="5" rx="0.5" transform="translate(-0.5 6.5) rotate(-90)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></rect><rect x="0.5" y="8" width="5" height="5" rx="0.5" transform="translate(-7.5 13.5) rotate(-90)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></rect></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g><path d="M11,3.5a3,3,0,0,0-3-3H4a1,1,0,0,0-1,1v5H8A3,3,0,0,0,11,3.5Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12,10a3.5,3.5,0,0,1-3.5,3.5H4a1,1,0,0,1-1-1v-6H8.5A3.5,3.5,0,0,1,12,10Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g><circle cx="1" cy="2.5" r="0.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></circle><line x1="4.5" y1="2.5" x2="13.5" y2="2.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><circle cx="1" cy="7" r="0.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></circle><line x1="4.5" y1="7" x2="13.5" y2="7" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><circle cx="1" cy="11.5" r="0.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></circle><line x1="4.5" y1="11.5" x2="13.5" y2="11.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g><g><path d="M3.5,10.78,6.64,3.45a.39.39,0,0,1,.72,0l3.14,7.33" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><line x1="4.69" y1="8" x2="9.31" y2="8" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line></g><rect x="0.5" y="0.5" width="13" height="13" rx="1" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></rect></g></svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
|
|
2
|
+
<g>
|
|
3
|
+
<path d="M3.5,10.78,6.64,3.45a.39.39,0,0,1,.72,0l3.14,7.33" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
4
|
+
<line x1="4.69" y1="8" x2="9.31" y2="8" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line>
|
|
5
|
+
<line x1="12" y1="1" x2="12" y2="4" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line>
|
|
6
|
+
<line x1="12" y1="1" x2="11" y2="1" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g><line x1="6.24" y1="6.24" x2="4" y2="13.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><line x1="1.5" y1="13.5" x2="6.5" y2="13.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><path d="M5,.5h7.5a1,1,0,0,1,1,1V3" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><line x1="0.5" y1="0.5" x2="13.5" y2="13.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><line x1="8" y1="0.5" x2="7.23" y2="3" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g><path d="M9.5,1.5H11a1,1,0,0,1,1,1v10a1,1,0,0,1-1,1H3a1,1,0,0,1-1-1V2.5a1,1,0,0,1,1-1H4.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><rect x="4.5" y="0.5" width="5" height="2.5" rx="1" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></rect></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g><polyline points="4 10.5 0.5 7 4 3.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></polyline><polyline points="10 10.5 13.5 7 10 3.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></polyline></g></svg>
|