bookish-press 0.5.26 → 0.5.62
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/dist/components/Auth.svelte.d.ts +2 -2
- package/dist/components/BookPreview.svelte +1 -0
- package/dist/components/BookPreview.svelte.d.ts +2 -2
- package/dist/components/Link.svelte.d.ts +2 -2
- package/dist/components/app/BookList.svelte.d.ts +2 -2
- package/dist/components/app/Button.svelte.d.ts +2 -2
- package/dist/components/app/Feedback.svelte.d.ts +2 -2
- package/dist/components/app/Head.svelte.d.ts +2 -2
- package/dist/components/app/Large.svelte.d.ts +2 -2
- package/dist/components/app/Lead.svelte.d.ts +2 -2
- package/dist/components/app/Link.svelte.d.ts +2 -2
- package/dist/components/app/Options.svelte.d.ts +2 -2
- package/dist/components/app/Paragraph.svelte.d.ts +2 -2
- package/dist/components/app/Section.svelte.d.ts +2 -2
- package/dist/components/app/Table.svelte.d.ts +2 -2
- package/dist/components/app/TextInput.svelte.d.ts +2 -2
- package/dist/components/chapter/Atom.svelte.d.ts +2 -2
- package/dist/components/chapter/Block.svelte.d.ts +2 -2
- package/dist/components/chapter/Callout.svelte.d.ts +2 -2
- package/dist/components/chapter/CaptionedCode.svelte.d.ts +2 -2
- package/dist/components/chapter/ChapterBody.svelte +2 -0
- package/dist/components/chapter/ChapterBody.svelte.d.ts +2 -2
- package/dist/components/chapter/Citations.svelte.d.ts +2 -2
- package/dist/components/chapter/Code.svelte.d.ts +2 -2
- package/dist/components/chapter/Comment.svelte.d.ts +2 -2
- package/dist/components/chapter/Definition.svelte +6 -7
- package/dist/components/chapter/Definition.svelte.d.ts +2 -2
- package/dist/components/chapter/Embed.svelte +4 -3
- package/dist/components/chapter/Embed.svelte.d.ts +2 -2
- package/dist/components/chapter/ErrorMessage.svelte.d.ts +2 -2
- package/dist/components/chapter/ExtendedPrism.d.ts +1 -1
- package/dist/components/chapter/Figure.svelte +6 -0
- package/dist/components/chapter/Figure.svelte.d.ts +2 -2
- package/dist/components/chapter/Footnote.svelte.d.ts +2 -2
- package/dist/components/chapter/Format.svelte +21 -16
- package/dist/components/chapter/Format.svelte.d.ts +2 -2
- package/dist/components/chapter/InlineCode.svelte.d.ts +2 -2
- package/dist/components/chapter/Label.svelte.d.ts +2 -2
- package/dist/components/chapter/LineBreak.svelte +6 -0
- package/dist/components/chapter/LineBreak.svelte.d.ts +17 -0
- package/dist/components/chapter/Link.svelte.d.ts +2 -2
- package/dist/components/chapter/List.svelte +16 -33
- package/dist/components/chapter/List.svelte.d.ts +2 -2
- package/dist/components/chapter/Marginal.svelte +5 -4
- package/dist/components/chapter/Marginal.svelte.d.ts +2 -2
- package/dist/components/chapter/Paragraph.svelte.d.ts +2 -2
- package/dist/components/chapter/Positioned.svelte.d.ts +2 -2
- package/dist/components/chapter/Problem.svelte.d.ts +2 -2
- package/dist/components/chapter/Python.svelte.d.ts +2 -2
- package/dist/components/chapter/Quote.svelte.d.ts +2 -2
- package/dist/components/chapter/Rule.svelte +2 -2
- package/dist/components/chapter/Rule.svelte.d.ts +2 -2
- package/dist/components/chapter/Table.svelte.d.ts +2 -2
- package/dist/components/chapter/Text.svelte.d.ts +2 -2
- package/dist/components/controls/DarkToggle.svelte +1 -1
- package/dist/components/controls/DarkToggle.svelte.d.ts +2 -2
- package/dist/components/editor/BookishEditor.svelte +13 -16
- package/dist/components/editor/BookishEditor.svelte.d.ts +2 -2
- package/dist/components/editor/CalloutEditor.svelte.d.ts +2 -2
- package/dist/components/editor/CaptionedCodeEditor.svelte.d.ts +2 -2
- package/dist/components/editor/CaretContext.d.ts +1 -1
- package/dist/components/editor/CaretView.svelte.d.ts +2 -2
- package/dist/components/editor/CitationsEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Commands.js +121 -55
- package/dist/components/editor/ConfirmButton.svelte +7 -1
- package/dist/components/editor/ConfirmButton.svelte.d.ts +2 -2
- package/dist/components/editor/DefinitionEditor.svelte.d.ts +2 -2
- package/dist/components/editor/EmbedEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Icon.svelte.d.ts +2 -2
- package/dist/components/editor/ImageChooser.svelte +2 -1
- package/dist/components/editor/ImageChooser.svelte.d.ts +2 -2
- package/dist/components/editor/ImageThumbnail.svelte +11 -7
- package/dist/components/editor/ImageThumbnail.svelte.d.ts +2 -2
- package/dist/components/editor/InlineCodeEditor.svelte.d.ts +2 -2
- package/dist/components/editor/LabelEditor.svelte.d.ts +2 -2
- package/dist/components/editor/LanguageEditor.svelte.d.ts +2 -2
- package/dist/components/editor/LinkEditor.svelte +4 -3
- package/dist/components/editor/LinkEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Note.svelte.d.ts +2 -2
- package/dist/components/editor/Permissions.svelte +2 -0
- package/dist/components/editor/Permissions.svelte.d.ts +2 -2
- package/dist/components/editor/PositionEditor.svelte.d.ts +2 -2
- package/dist/components/editor/QuoteEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Switch.svelte.d.ts +2 -2
- package/dist/components/editor/TableEditor.svelte.d.ts +2 -2
- package/dist/components/editor/TextEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Toggle.svelte +1 -1
- package/dist/components/editor/Toggle.svelte.d.ts +2 -2
- package/dist/components/editor/Toolbar.svelte +2 -1
- package/dist/components/editor/Toolbar.svelte.d.ts +2 -2
- package/dist/components/editor/ToolbarGroup.svelte.d.ts +2 -2
- package/dist/components/editor/ToolbarSpacer.svelte.d.ts +2 -2
- package/dist/components/editor/URLEditor.svelte.d.ts +2 -2
- package/dist/components/page/Acknowledgements.svelte.d.ts +2 -2
- package/dist/components/page/Authors.svelte.d.ts +2 -2
- package/dist/components/page/BookLoader.svelte.d.ts +2 -2
- package/dist/components/page/BulkReferenceEditor.svelte.d.ts +2 -2
- package/dist/components/page/Chapter.svelte +1 -1
- package/dist/components/page/Chapter.svelte.d.ts +2 -2
- package/dist/components/page/ChapterNumber.svelte.d.ts +2 -2
- package/dist/components/page/ChapterTitle.svelte.d.ts +2 -2
- package/dist/components/page/DefinitionView.svelte.d.ts +2 -2
- package/dist/components/page/Description.svelte.d.ts +2 -2
- package/dist/components/page/Edition.svelte.d.ts +2 -2
- package/dist/components/page/EditionLoader.svelte +12 -3
- package/dist/components/page/EditionLoader.svelte.d.ts +2 -2
- package/dist/components/page/Editions.svelte +1 -1
- package/dist/components/page/Editions.svelte.d.ts +2 -2
- package/dist/components/page/Glossary.svelte.d.ts +2 -2
- package/dist/components/page/Header.svelte.d.ts +2 -2
- package/dist/components/page/Index.svelte.d.ts +2 -2
- package/dist/components/page/Instructions.svelte.d.ts +2 -2
- package/dist/components/page/License.svelte.d.ts +2 -2
- package/dist/components/page/Loading.svelte.d.ts +2 -2
- package/dist/components/page/Media.svelte.d.ts +2 -2
- package/dist/components/page/MediaPreview.svelte.d.ts +2 -2
- package/dist/components/page/Muted.svelte.d.ts +2 -2
- package/dist/components/page/Outline.svelte +1 -1
- package/dist/components/page/Outline.svelte.d.ts +2 -2
- package/dist/components/page/Page.svelte.d.ts +2 -2
- package/dist/components/page/PageHeader.svelte.d.ts +2 -2
- package/dist/components/page/PageParagraph.svelte.d.ts +2 -2
- package/dist/components/page/PossibleChapter.svelte.d.ts +2 -2
- package/dist/components/page/PossibleReference.svelte.d.ts +2 -2
- package/dist/components/page/Print.svelte.d.ts +2 -2
- package/dist/components/page/Publish.svelte.d.ts +2 -2
- package/dist/components/page/Reference.svelte.d.ts +2 -2
- package/dist/components/page/References.svelte.d.ts +2 -2
- package/dist/components/page/Rows.svelte.d.ts +2 -2
- package/dist/components/page/Search.svelte.d.ts +2 -2
- package/dist/components/page/Status.svelte.d.ts +2 -2
- package/dist/components/page/SubdomainEditor.svelte.d.ts +2 -2
- package/dist/components/page/TableOfContents.svelte +2 -2
- package/dist/components/page/TableOfContents.svelte.d.ts +2 -2
- package/dist/components/page/TableOfContentsImage.svelte.d.ts +2 -2
- package/dist/components/page/TableOfContentsRow.svelte +1 -1
- package/dist/components/page/TableOfContentsRow.svelte.d.ts +2 -2
- package/dist/components/page/ThemeEditor.svelte.d.ts +2 -2
- package/dist/components/page/ThemeEditorPreview.svelte.d.ts +2 -2
- package/dist/components/page/ThemeSetEditor.svelte.d.ts +2 -2
- package/dist/components/page/ThemeVariableEditor.svelte.d.ts +2 -2
- package/dist/components/page/Title.svelte.d.ts +2 -2
- package/dist/components/page/Unknown.svelte.d.ts +2 -2
- package/dist/models/CRUD.d.ts +1 -0
- package/dist/models/CRUD.js +17 -4
- package/dist/models/book/Chapter.d.ts +10 -8
- package/dist/models/book/Chapter.js +16 -6
- package/dist/models/book/Edition.d.ts +3 -2
- package/dist/models/book/Edition.js +12 -5
- package/dist/models/chapter/Caret.d.ts +2 -1
- package/dist/models/chapter/Caret.js +20 -6
- package/dist/models/chapter/DefinitionNode.js +1 -1
- package/dist/models/chapter/FormatNode.d.ts +4 -1
- package/dist/models/chapter/FormatNode.js +57 -10
- package/dist/models/chapter/InlineCodeNode.js +1 -1
- package/dist/models/chapter/LineBreakNode.d.ts +15 -0
- package/dist/models/chapter/LineBreakNode.js +37 -0
- package/dist/models/chapter/LinkNode.js +1 -1
- package/dist/models/chapter/ListNode.js +1 -1
- package/dist/models/chapter/Parser.d.ts +2 -0
- package/dist/models/chapter/Parser.js +15 -8
- package/dist/models/chapter/Symbols.d.ts +1 -0
- package/dist/models/chapter/Symbols.js +1 -0
- package/package.json +23 -23
|
@@ -53,6 +53,7 @@ import SuperscriptIcon from './icons/super.svg?raw';
|
|
|
53
53
|
import TableIcon from './icons/table.svg?raw';
|
|
54
54
|
import UndoIcon from './icons/undo.svg?raw';
|
|
55
55
|
import UnindentIcon from './icons/unindent.svg?raw';
|
|
56
|
+
import LineBreakNode from '../../models/chapter/LineBreakNode';
|
|
56
57
|
/**
|
|
57
58
|
* Icons:
|
|
58
59
|
* From: https://www.streamlinehq.com/icons/streamline-mini-line
|
|
@@ -119,9 +120,9 @@ const commands = [
|
|
|
119
120
|
shift: false,
|
|
120
121
|
key: 'ArrowUp',
|
|
121
122
|
visible: (context) => context.table !== undefined,
|
|
122
|
-
active: (context) => context.table !== undefined && context.
|
|
123
|
-
handler: (context) => context.table !== undefined && context.
|
|
124
|
-
? insertTableRowColumn(context, context.table, context.
|
|
123
|
+
active: (context) => context.table !== undefined && context.formatRoot !== undefined,
|
|
124
|
+
handler: (context) => context.table !== undefined && context.formatRoot !== undefined
|
|
125
|
+
? insertTableRowColumn(context, context.table, context.formatRoot, true, true)
|
|
125
126
|
: undefined,
|
|
126
127
|
},
|
|
127
128
|
{
|
|
@@ -134,9 +135,9 @@ const commands = [
|
|
|
134
135
|
shift: false,
|
|
135
136
|
key: 'ArrowDown',
|
|
136
137
|
visible: (context) => context.table !== undefined,
|
|
137
|
-
active: (context) => context.table !== undefined && context.
|
|
138
|
-
handler: (context) => context.table !== undefined && context.
|
|
139
|
-
? insertTableRowColumn(context, context.table, context.
|
|
138
|
+
active: (context) => context.table !== undefined && context.formatRoot !== undefined,
|
|
139
|
+
handler: (context) => context.table !== undefined && context.formatRoot !== undefined
|
|
140
|
+
? insertTableRowColumn(context, context.table, context.formatRoot, true, false)
|
|
140
141
|
: undefined,
|
|
141
142
|
},
|
|
142
143
|
{
|
|
@@ -149,9 +150,9 @@ const commands = [
|
|
|
149
150
|
shift: false,
|
|
150
151
|
key: 'ArrowRight',
|
|
151
152
|
visible: (context) => context.table !== undefined,
|
|
152
|
-
active: (context) => context.table !== undefined && context.
|
|
153
|
-
handler: (context) => context.table !== undefined && context.
|
|
154
|
-
? insertTableRowColumn(context, context.table, context.
|
|
153
|
+
active: (context) => context.table !== undefined && context.formatRoot !== undefined,
|
|
154
|
+
handler: (context) => context.table !== undefined && context.formatRoot !== undefined
|
|
155
|
+
? insertTableRowColumn(context, context.table, context.formatRoot, false, false)
|
|
155
156
|
: undefined,
|
|
156
157
|
},
|
|
157
158
|
{
|
|
@@ -164,9 +165,9 @@ const commands = [
|
|
|
164
165
|
shift: false,
|
|
165
166
|
key: 'ArrowLeft',
|
|
166
167
|
visible: (context) => context.table !== undefined,
|
|
167
|
-
active: (context) => context.table !== undefined && context.
|
|
168
|
-
handler: (context) => context.table !== undefined && context.
|
|
169
|
-
? insertTableRowColumn(context, context.table, context.
|
|
168
|
+
active: (context) => context.table !== undefined && context.formatRoot !== undefined,
|
|
169
|
+
handler: (context) => context.table !== undefined && context.formatRoot !== undefined
|
|
170
|
+
? insertTableRowColumn(context, context.table, context.formatRoot, false, true)
|
|
170
171
|
: undefined,
|
|
171
172
|
},
|
|
172
173
|
{
|
|
@@ -179,11 +180,11 @@ const commands = [
|
|
|
179
180
|
shift: false,
|
|
180
181
|
key: 'Backspace',
|
|
181
182
|
visible: (context) => context.table !== undefined,
|
|
182
|
-
active: (context) => context.
|
|
183
|
+
active: (context) => context.formatRoot !== undefined &&
|
|
183
184
|
context.table !== undefined &&
|
|
184
185
|
context.table.getRowCount() > 1,
|
|
185
|
-
handler: (context) => context.
|
|
186
|
-
? deleteTableRowColumn(context, context.table, context.
|
|
186
|
+
handler: (context) => context.formatRoot !== undefined && context.table !== undefined
|
|
187
|
+
? deleteTableRowColumn(context, context.table, context.formatRoot, true)
|
|
187
188
|
: undefined,
|
|
188
189
|
},
|
|
189
190
|
{
|
|
@@ -196,11 +197,11 @@ const commands = [
|
|
|
196
197
|
shift: true,
|
|
197
198
|
key: 'Backspace',
|
|
198
199
|
visible: (context) => context.table !== undefined,
|
|
199
|
-
active: (context) => context.
|
|
200
|
+
active: (context) => context.formatRoot !== undefined &&
|
|
200
201
|
context.table !== undefined &&
|
|
201
202
|
context.table.getColumnCount() > 1,
|
|
202
|
-
handler: (context) => context.
|
|
203
|
-
? deleteTableRowColumn(context, context.table, context.
|
|
203
|
+
handler: (context) => context.formatRoot !== undefined && context.table !== undefined
|
|
204
|
+
? deleteTableRowColumn(context, context.table, context.formatRoot, false)
|
|
204
205
|
: undefined,
|
|
205
206
|
},
|
|
206
207
|
{
|
|
@@ -213,11 +214,11 @@ const commands = [
|
|
|
213
214
|
shift: false,
|
|
214
215
|
key: 'Tab',
|
|
215
216
|
visible: () => false,
|
|
216
|
-
active: (context) => context.
|
|
217
|
+
active: (context) => context.formatRoot !== undefined,
|
|
217
218
|
handler: (context) => {
|
|
218
|
-
if (context.
|
|
219
|
+
if (context.formatRoot) {
|
|
219
220
|
let caret = context.root
|
|
220
|
-
.getNodeAfter(context.
|
|
221
|
+
.getNodeAfter(context.formatRoot, (node) => node instanceof FormatNode)
|
|
221
222
|
?.getFirstCaret();
|
|
222
223
|
if (caret)
|
|
223
224
|
return {
|
|
@@ -237,12 +238,12 @@ const commands = [
|
|
|
237
238
|
shift: true,
|
|
238
239
|
key: 'Tab',
|
|
239
240
|
visible: () => false,
|
|
240
|
-
active: (context) => context.
|
|
241
|
+
active: (context) => context.formatRoot !== undefined,
|
|
241
242
|
// If we're in a table, find the previous cell.
|
|
242
243
|
handler: (context) => {
|
|
243
|
-
if (context.
|
|
244
|
+
if (context.formatRoot) {
|
|
244
245
|
let caret = context.root
|
|
245
|
-
.getNodeBefore(context.
|
|
246
|
+
.getNodeBefore(context.formatRoot, (node) => node instanceof FormatNode)
|
|
246
247
|
?.getFirstCaret();
|
|
247
248
|
if (caret)
|
|
248
249
|
return {
|
|
@@ -314,10 +315,10 @@ const commands = [
|
|
|
314
315
|
shift: false,
|
|
315
316
|
key: 'ArrowLeft',
|
|
316
317
|
visible: false,
|
|
317
|
-
active: (context) => context.
|
|
318
|
+
active: (context) => context.formatRoot !== undefined,
|
|
318
319
|
handler: (context) => {
|
|
319
|
-
if (context.
|
|
320
|
-
const first = context.
|
|
320
|
+
if (context.formatRoot !== undefined) {
|
|
321
|
+
const first = context.formatRoot.getFirstTextNode();
|
|
321
322
|
return {
|
|
322
323
|
root: context.root,
|
|
323
324
|
range: {
|
|
@@ -386,10 +387,10 @@ const commands = [
|
|
|
386
387
|
shift: true,
|
|
387
388
|
key: 'ArrowLeft',
|
|
388
389
|
visible: false,
|
|
389
|
-
active: (context) => context.
|
|
390
|
+
active: (context) => context.formatRoot !== undefined,
|
|
390
391
|
handler: (context) => {
|
|
391
|
-
if (context.
|
|
392
|
-
const first = context.
|
|
392
|
+
if (context.formatRoot !== undefined) {
|
|
393
|
+
const first = context.formatRoot.getFirstTextNode();
|
|
393
394
|
return {
|
|
394
395
|
root: context.root,
|
|
395
396
|
range: {
|
|
@@ -460,10 +461,10 @@ const commands = [
|
|
|
460
461
|
shift: false,
|
|
461
462
|
key: 'ArrowRight',
|
|
462
463
|
visible: false,
|
|
463
|
-
active: (context) => context.
|
|
464
|
+
active: (context) => context.formatRoot !== undefined,
|
|
464
465
|
handler: (context) => {
|
|
465
|
-
if (context.
|
|
466
|
-
const last = context.
|
|
466
|
+
if (context.formatRoot !== undefined) {
|
|
467
|
+
const last = context.formatRoot.getLastTextNode();
|
|
467
468
|
const caret = { node: last, index: last.getLength() };
|
|
468
469
|
return {
|
|
469
470
|
root: context.root,
|
|
@@ -530,10 +531,10 @@ const commands = [
|
|
|
530
531
|
shift: true,
|
|
531
532
|
key: 'ArrowRight',
|
|
532
533
|
visible: false,
|
|
533
|
-
active: (context) => context.
|
|
534
|
+
active: (context) => context.formatRoot !== undefined,
|
|
534
535
|
handler: (context) => {
|
|
535
|
-
if (context.
|
|
536
|
-
const last = context.
|
|
536
|
+
if (context.formatRoot !== undefined) {
|
|
537
|
+
const last = context.formatRoot.getLastTextNode();
|
|
537
538
|
return {
|
|
538
539
|
root: context.root,
|
|
539
540
|
range: {
|
|
@@ -582,12 +583,12 @@ const commands = [
|
|
|
582
583
|
// If in a non paragraph block, expand to the format of whatever format we're in.
|
|
583
584
|
else if (context.paragraph === undefined &&
|
|
584
585
|
context.block &&
|
|
585
|
-
context.
|
|
586
|
+
context.formatRoot) {
|
|
586
587
|
return {
|
|
587
588
|
root: context.root,
|
|
588
589
|
range: {
|
|
589
|
-
start: context.
|
|
590
|
-
end: context.
|
|
590
|
+
start: context.formatRoot.getFirstCaret(),
|
|
591
|
+
end: context.formatRoot.getLastCaret(),
|
|
591
592
|
},
|
|
592
593
|
};
|
|
593
594
|
}
|
|
@@ -818,8 +819,8 @@ const commands = [
|
|
|
818
819
|
},
|
|
819
820
|
},
|
|
820
821
|
{
|
|
821
|
-
icon: '
|
|
822
|
-
description: '
|
|
822
|
+
icon: 'convert inline code to block code',
|
|
823
|
+
description: 'convert inline code to block code',
|
|
823
824
|
category: 'text',
|
|
824
825
|
mutates: true,
|
|
825
826
|
control: false,
|
|
@@ -827,26 +828,78 @@ const commands = [
|
|
|
827
828
|
shift: false,
|
|
828
829
|
key: 'Enter',
|
|
829
830
|
visible: false,
|
|
830
|
-
|
|
831
|
+
// We must be in a solo inline code node (other than empty text nodes) that's in a paragraph that's in a blocks node
|
|
832
|
+
active: (context) => {
|
|
833
|
+
if (!(context.block instanceof ParagraphNode) ||
|
|
834
|
+
context.blocks === undefined)
|
|
835
|
+
return false;
|
|
836
|
+
const nonEmptySegments = context.block
|
|
837
|
+
.getFormat()
|
|
838
|
+
.getSegments()
|
|
839
|
+
.filter((n) => !(n instanceof TextNode && n.getText() === ''));
|
|
840
|
+
return (nonEmptySegments.length === 1 &&
|
|
841
|
+
nonEmptySegments[0] instanceof InlineCodeNode);
|
|
842
|
+
},
|
|
831
843
|
handler: (context) => {
|
|
832
|
-
|
|
844
|
+
// Find the inline code node we're in
|
|
845
|
+
const inline = context.range.start.node.getClosestParentOfType(context.root, InlineCodeNode);
|
|
846
|
+
const block = context.block;
|
|
847
|
+
const blocks = context.blocks;
|
|
848
|
+
if (block === undefined ||
|
|
849
|
+
blocks === undefined ||
|
|
850
|
+
inline === undefined)
|
|
851
|
+
return;
|
|
852
|
+
// First, remove the inline code block from the block it's in.
|
|
853
|
+
const newBlock = block.withNodeReplaced(inline, undefined);
|
|
854
|
+
if (newBlock === undefined)
|
|
855
|
+
return;
|
|
856
|
+
let newBlocks = blocks.withChildReplaced(block, newBlock);
|
|
857
|
+
if (newBlocks === undefined)
|
|
858
|
+
return;
|
|
859
|
+
newBlocks = newBlocks.withBlockInsertedAfter(newBlock, new CodeNode(inline.getText(), inline.getMeta(), '<'));
|
|
860
|
+
if (newBlocks === undefined)
|
|
861
|
+
return;
|
|
862
|
+
return rootWithNode(context, blocks, newBlocks, () => context.range.start);
|
|
863
|
+
},
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
icon: 'insert line break',
|
|
867
|
+
description: 'insert line break',
|
|
868
|
+
category: 'text',
|
|
869
|
+
mutates: true,
|
|
870
|
+
control: false,
|
|
871
|
+
alt: false,
|
|
872
|
+
shift: true,
|
|
873
|
+
key: 'Enter',
|
|
874
|
+
visible: false,
|
|
875
|
+
active: true,
|
|
876
|
+
handler: (context) => {
|
|
877
|
+
const format = context.range.start.node.getClosestParentOfType(context.root, FormatNode);
|
|
878
|
+
if (format === undefined)
|
|
879
|
+
return;
|
|
880
|
+
const edit = format.withNodeInserted(context.range.start, new LineBreakNode());
|
|
833
881
|
if (edit === undefined)
|
|
834
882
|
return;
|
|
835
|
-
return rootWithNode(context,
|
|
883
|
+
return rootWithNode(context, format, edit.root, () => edit.range.start);
|
|
836
884
|
},
|
|
837
885
|
},
|
|
838
886
|
{
|
|
839
|
-
icon:
|
|
840
|
-
description: '
|
|
841
|
-
category: '
|
|
887
|
+
icon: 'split paragraph',
|
|
888
|
+
description: 'split paragraph',
|
|
889
|
+
category: 'text',
|
|
842
890
|
mutates: true,
|
|
843
891
|
control: false,
|
|
844
892
|
alt: false,
|
|
845
893
|
shift: false,
|
|
846
|
-
key: '
|
|
847
|
-
visible:
|
|
848
|
-
active: (context) => context.
|
|
849
|
-
handler: (context) =>
|
|
894
|
+
key: 'Enter',
|
|
895
|
+
visible: false,
|
|
896
|
+
active: (context) => context.atom === undefined && context.blocks !== undefined,
|
|
897
|
+
handler: (context) => {
|
|
898
|
+
const edit = context.blocks?.withSelectionSplit(context.range);
|
|
899
|
+
if (edit === undefined)
|
|
900
|
+
return;
|
|
901
|
+
return rootWithNode(context, context.blocks, edit.root, () => edit.range.start);
|
|
902
|
+
},
|
|
850
903
|
},
|
|
851
904
|
{
|
|
852
905
|
icon: UnindentIcon,
|
|
@@ -862,6 +915,19 @@ const commands = [
|
|
|
862
915
|
context.list.isInside(context.root, ListNode),
|
|
863
916
|
handler: (context) => rootWithNode(context, context.blocks, context.blocks?.withListsIndented(context.range, false)),
|
|
864
917
|
},
|
|
918
|
+
{
|
|
919
|
+
icon: IndentIcon,
|
|
920
|
+
description: 'indent list item',
|
|
921
|
+
category: 'list',
|
|
922
|
+
mutates: true,
|
|
923
|
+
control: false,
|
|
924
|
+
alt: false,
|
|
925
|
+
shift: false,
|
|
926
|
+
key: 'Tab',
|
|
927
|
+
visible: (context) => context.list !== undefined,
|
|
928
|
+
active: (context) => context.list !== undefined,
|
|
929
|
+
handler: (context) => rootWithNode(context, context.blocks, context.blocks?.withListsIndented(context.range, true)),
|
|
930
|
+
},
|
|
865
931
|
{
|
|
866
932
|
icon: ClearIcon,
|
|
867
933
|
description: 'clear formatting',
|
|
@@ -939,7 +1005,7 @@ const commands = [
|
|
|
939
1005
|
visible: true,
|
|
940
1006
|
active: (context) => context.startIsText || context.endIsText,
|
|
941
1007
|
handler: (context) => context.meta instanceof InlineCodeNode
|
|
942
|
-
? rootWithNode(context, context.
|
|
1008
|
+
? rootWithNode(context, context.formatRoot, context.formatRoot?.withSegmentReplaced(context.meta, context.meta.getText()))
|
|
943
1009
|
: context.root.withSegmentAtSelection(context.range, (text) => new InlineCodeNode(new TextNode(text))),
|
|
944
1010
|
},
|
|
945
1011
|
{
|
|
@@ -955,7 +1021,7 @@ const commands = [
|
|
|
955
1021
|
active: (context) => (context.atom === undefined && context.meta === undefined) ||
|
|
956
1022
|
context.meta instanceof LinkNode,
|
|
957
1023
|
handler: (context) => context.meta instanceof LinkNode
|
|
958
|
-
? rootWithNode(context, context.
|
|
1024
|
+
? rootWithNode(context, context.formatRoot, context.formatRoot?.withSegmentReplaced(context.meta, context.meta.getText()))
|
|
959
1025
|
: context.root.withSegmentAtSelection(context.range, (text) => new LinkNode(new TextNode(text))),
|
|
960
1026
|
},
|
|
961
1027
|
{
|
|
@@ -974,7 +1040,7 @@ const commands = [
|
|
|
974
1040
|
context.atom === undefined &&
|
|
975
1041
|
context.meta === undefined,
|
|
976
1042
|
handler: (context) => context.meta instanceof DefinitionNode
|
|
977
|
-
? rootWithNode(context, context.
|
|
1043
|
+
? rootWithNode(context, context.formatRoot, context.formatRoot?.withSegmentReplaced(context.meta, context.meta.getText()))
|
|
978
1044
|
: context.root.withSegmentAtSelection(context.range, (text) => new DefinitionNode(new TextNode(text))),
|
|
979
1045
|
},
|
|
980
1046
|
{
|
|
@@ -1222,7 +1288,7 @@ const commands = [
|
|
|
1222
1288
|
const newTable = new TableNode(newRows, '|', new FormatNode('', [new TextNode()]));
|
|
1223
1289
|
return rootWithNode(context, context.blocks, context.blocks.withBlockInsertedBefore(context.paragraph, newTable), () => {
|
|
1224
1290
|
return {
|
|
1225
|
-
node: newTable.getRows()[0][0].
|
|
1291
|
+
node: newTable.getRows()[0][0].getFirstTextNode(),
|
|
1226
1292
|
index: 0,
|
|
1227
1293
|
};
|
|
1228
1294
|
});
|
|
@@ -10,7 +10,13 @@ let confirming = false;
|
|
|
10
10
|
<Button {tooltip} command={() => (confirming = true)}><slot /></Button>
|
|
11
11
|
{:else}
|
|
12
12
|
<Button tooltip="no" command={() => (confirming = false)}>cancel</Button
|
|
13
|
-
> <Button
|
|
13
|
+
> <Button
|
|
14
|
+
tooltip="yes"
|
|
15
|
+
command={() => {
|
|
16
|
+
confirming = false;
|
|
17
|
+
command();
|
|
18
|
+
}}>{confirm}</Button
|
|
19
|
+
>
|
|
14
20
|
{/if}
|
|
15
21
|
</div>
|
|
16
22
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
tooltip: string;
|
|
@@ -15,6 +15,6 @@ declare const __propDef: {
|
|
|
15
15
|
export type ConfirmButtonProps = typeof __propDef.props;
|
|
16
16
|
export type ConfirmButtonEvents = typeof __propDef.events;
|
|
17
17
|
export type ConfirmButtonSlots = typeof __propDef.slots;
|
|
18
|
-
export default class ConfirmButton extends
|
|
18
|
+
export default class ConfirmButton extends SvelteComponent<ConfirmButtonProps, ConfirmButtonEvents, ConfirmButtonSlots> {
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type DefinitionNode from '../../models/chapter/DefinitionNode';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -12,6 +12,6 @@ declare const __propDef: {
|
|
|
12
12
|
export type DefinitionEditorProps = typeof __propDef.props;
|
|
13
13
|
export type DefinitionEditorEvents = typeof __propDef.events;
|
|
14
14
|
export type DefinitionEditorSlots = typeof __propDef.slots;
|
|
15
|
-
export default class DefinitionEditor extends
|
|
15
|
+
export default class DefinitionEditor extends SvelteComponent<DefinitionEditorProps, DefinitionEditorEvents, DefinitionEditorSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import EmbedNode from '../../models/chapter/EmbedNode';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -12,6 +12,6 @@ declare const __propDef: {
|
|
|
12
12
|
export type EmbedEditorProps = typeof __propDef.props;
|
|
13
13
|
export type EmbedEditorEvents = typeof __propDef.events;
|
|
14
14
|
export type EmbedEditorSlots = typeof __propDef.slots;
|
|
15
|
-
export default class EmbedEditor extends
|
|
15
|
+
export default class EmbedEditor extends SvelteComponent<EmbedEditorProps, EmbedEditorEvents, EmbedEditorSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
icon: string;
|
|
@@ -11,6 +11,6 @@ declare const __propDef: {
|
|
|
11
11
|
export type IconProps = typeof __propDef.props;
|
|
12
12
|
export type IconEvents = typeof __propDef.events;
|
|
13
13
|
export type IconSlots = typeof __propDef.slots;
|
|
14
|
-
export default class Icon extends
|
|
14
|
+
export default class Icon extends SvelteComponent<IconProps, IconEvents, IconSlots> {
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { Image } from '../../models/book/BookMedia';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -13,6 +13,6 @@ declare const __propDef: {
|
|
|
13
13
|
export type ImageChooserProps = typeof __propDef.props;
|
|
14
14
|
export type ImageChooserEvents = typeof __propDef.events;
|
|
15
15
|
export type ImageChooserSlots = typeof __propDef.slots;
|
|
16
|
-
export default class ImageChooser extends
|
|
16
|
+
export default class ImageChooser extends SvelteComponent<ImageChooserProps, ImageChooserEvents, ImageChooserSlots> {
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -27,18 +27,22 @@ loadImage(image.thumb);
|
|
|
27
27
|
{#if loading}
|
|
28
28
|
<div class="thumbnail loading" />
|
|
29
29
|
{:else}
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
src={error ? image.url : image.thumb}
|
|
34
|
-
alt={`Image named ${image.url}`}
|
|
35
|
-
tabIndex="0"
|
|
30
|
+
<div
|
|
31
|
+
tabindex="0"
|
|
32
|
+
role="button"
|
|
36
33
|
on:click|stopPropagation={() => select(image)}
|
|
37
34
|
on:keydown={(event) =>
|
|
38
35
|
event.key === 'Enter' || event.key === ' '
|
|
39
36
|
? select(image)
|
|
40
37
|
: undefined}
|
|
41
|
-
|
|
38
|
+
>
|
|
39
|
+
<img
|
|
40
|
+
class="thumbnail"
|
|
41
|
+
class:selected
|
|
42
|
+
src={error ? image.url : image.thumb}
|
|
43
|
+
alt={`Image named ${image.url}`}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
42
46
|
{/if}
|
|
43
47
|
|
|
44
48
|
<style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { Image } from '../../models/book/BookMedia';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -14,6 +14,6 @@ declare const __propDef: {
|
|
|
14
14
|
export type ImageThumbnailProps = typeof __propDef.props;
|
|
15
15
|
export type ImageThumbnailEvents = typeof __propDef.events;
|
|
16
16
|
export type ImageThumbnailSlots = typeof __propDef.slots;
|
|
17
|
-
export default class ImageThumbnail extends
|
|
17
|
+
export default class ImageThumbnail extends SvelteComponent<ImageThumbnailProps, ImageThumbnailEvents, ImageThumbnailSlots> {
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type InlineCodeNode from '../../models/chapter/InlineCodeNode';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -12,6 +12,6 @@ declare const __propDef: {
|
|
|
12
12
|
export type InlineCodeEditorProps = typeof __propDef.props;
|
|
13
13
|
export type InlineCodeEditorEvents = typeof __propDef.events;
|
|
14
14
|
export type InlineCodeEditorSlots = typeof __propDef.slots;
|
|
15
|
-
export default class InlineCodeEditor extends
|
|
15
|
+
export default class InlineCodeEditor extends SvelteComponent<InlineCodeEditorProps, InlineCodeEditorEvents, InlineCodeEditorSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type LabelNode from '../../models/chapter/LabelNode';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -12,6 +12,6 @@ declare const __propDef: {
|
|
|
12
12
|
export type LabelEditorProps = typeof __propDef.props;
|
|
13
13
|
export type LabelEditorEvents = typeof __propDef.events;
|
|
14
14
|
export type LabelEditorSlots = typeof __propDef.slots;
|
|
15
|
-
export default class LabelEditor extends
|
|
15
|
+
export default class LabelEditor extends SvelteComponent<LabelEditorProps, LabelEditorEvents, LabelEditorSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
language: string;
|
|
@@ -12,6 +12,6 @@ declare const __propDef: {
|
|
|
12
12
|
export type LanguageEditorProps = typeof __propDef.props;
|
|
13
13
|
export type LanguageEditorEvents = typeof __propDef.events;
|
|
14
14
|
export type LanguageEditorSlots = typeof __propDef.slots;
|
|
15
|
-
export default class LanguageEditor extends
|
|
15
|
+
export default class LanguageEditor extends SvelteComponent<LanguageEditorProps, LanguageEditorEvents, LanguageEditorSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -70,12 +70,13 @@ $: {
|
|
|
70
70
|
<Button
|
|
71
71
|
tooltip="remove link"
|
|
72
72
|
command={() => {
|
|
73
|
-
if ($caret?.context?.
|
|
74
|
-
const newFormat = $caret.context.
|
|
73
|
+
if ($caret?.context?.formatRoot) {
|
|
74
|
+
const newFormat = $caret.context.formatRoot.withSegmentReplaced(
|
|
75
75
|
link,
|
|
76
76
|
link.getText()
|
|
77
77
|
);
|
|
78
|
-
if (newFormat)
|
|
78
|
+
if (newFormat)
|
|
79
|
+
$caret.edit($caret.context.formatRoot, newFormat);
|
|
79
80
|
}
|
|
80
81
|
}}
|
|
81
82
|
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type LinkNode from '../../models/chapter/LinkNode';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -12,6 +12,6 @@ declare const __propDef: {
|
|
|
12
12
|
export type LinkEditorProps = typeof __propDef.props;
|
|
13
13
|
export type LinkEditorEvents = typeof __propDef.events;
|
|
14
14
|
export type LinkEditorSlots = typeof __propDef.slots;
|
|
15
|
-
export default class LinkEditor extends
|
|
15
|
+
export default class LinkEditor extends SvelteComponent<LinkEditorProps, LinkEditorEvents, LinkEditorSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} NoteProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} NoteEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} NoteSlots */
|
|
4
|
-
export default class Note extends
|
|
4
|
+
export default class Note extends SvelteComponent<{
|
|
5
5
|
[x: string]: never;
|
|
6
6
|
}, {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
@@ -12,7 +12,7 @@ export default class Note extends SvelteComponentTyped<{
|
|
|
12
12
|
export type NoteProps = typeof __propDef.props;
|
|
13
13
|
export type NoteEvents = typeof __propDef.events;
|
|
14
14
|
export type NoteSlots = typeof __propDef.slots;
|
|
15
|
-
import {
|
|
15
|
+
import { SvelteComponent } from "svelte";
|
|
16
16
|
declare const __propDef: {
|
|
17
17
|
props: {
|
|
18
18
|
[x: string]: never;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
uids: string[];
|
|
@@ -15,6 +15,6 @@ declare const __propDef: {
|
|
|
15
15
|
export type PermissionsProps = typeof __propDef.props;
|
|
16
16
|
export type PermissionsEvents = typeof __propDef.events;
|
|
17
17
|
export type PermissionsSlots = typeof __propDef.slots;
|
|
18
|
-
export default class Permissions extends
|
|
18
|
+
export default class Permissions extends SvelteComponent<PermissionsProps, PermissionsEvents, PermissionsSlots> {
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type Position from '../../models/chapter/Position';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -13,6 +13,6 @@ declare const __propDef: {
|
|
|
13
13
|
export type PositionEditorProps = typeof __propDef.props;
|
|
14
14
|
export type PositionEditorEvents = typeof __propDef.events;
|
|
15
15
|
export type PositionEditorSlots = typeof __propDef.slots;
|
|
16
|
-
export default class PositionEditor extends
|
|
16
|
+
export default class PositionEditor extends SvelteComponent<PositionEditorProps, PositionEditorEvents, PositionEditorSlots> {
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type QuoteNode from '../../models/chapter/QuoteNode';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -12,6 +12,6 @@ declare const __propDef: {
|
|
|
12
12
|
export type QuoteEditorProps = typeof __propDef.props;
|
|
13
13
|
export type QuoteEditorEvents = typeof __propDef.events;
|
|
14
14
|
export type QuoteEditorSlots = typeof __propDef.slots;
|
|
15
|
-
export default class QuoteEditor extends
|
|
15
|
+
export default class QuoteEditor extends SvelteComponent<QuoteEditorProps, QuoteEditorEvents, QuoteEditorSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
options: string[];
|
|
@@ -15,6 +15,6 @@ declare const __propDef: {
|
|
|
15
15
|
export type SwitchProps = typeof __propDef.props;
|
|
16
16
|
export type SwitchEvents = typeof __propDef.events;
|
|
17
17
|
export type SwitchSlots = typeof __propDef.slots;
|
|
18
|
-
export default class Switch extends
|
|
18
|
+
export default class Switch extends SvelteComponent<SwitchProps, SwitchEvents, SwitchSlots> {
|
|
19
19
|
}
|
|
20
20
|
export {};
|