@podlite/editor-react 0.0.21 → 0.0.23
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/CHANGELOG.md +8 -0
- package/lib/index.cjs +175 -24
- package/lib/index.cjs.map +2 -2
- package/lib/index.d.ts +4 -0
- package/lib/index.esm.js +175 -24
- package/lib/index.esm.js.map +2 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import 'codemirror/mode/gfm/gfm';
|
|
3
3
|
import 'codemirror/addon/hint/show-hint';
|
|
4
4
|
import 'codemirror/addon/hint/show-hint.css';
|
|
5
|
+
import 'codemirror/addon/search/search';
|
|
6
|
+
import 'codemirror/addon/search/searchcursor';
|
|
7
|
+
import 'codemirror/addon/dialog/dialog';
|
|
8
|
+
import 'codemirror/addon/dialog/dialog.css';
|
|
5
9
|
import './Editor.css';
|
|
6
10
|
export interface ConverterResult {
|
|
7
11
|
errors?: any;
|
package/lib/index.esm.js
CHANGED
|
@@ -6914,6 +6914,9 @@ var require_AstTree = __commonJS({
|
|
|
6914
6914
|
{
|
|
6915
6915
|
$ref: "#/definitions/BlockImage"
|
|
6916
6916
|
},
|
|
6917
|
+
{
|
|
6918
|
+
$ref: "#/definitions/BlockPicture"
|
|
6919
|
+
},
|
|
6917
6920
|
{
|
|
6918
6921
|
$ref: "#/definitions/BlockCaption"
|
|
6919
6922
|
},
|
|
@@ -7252,6 +7255,71 @@ var require_AstTree = __commonJS({
|
|
|
7252
7255
|
"value"
|
|
7253
7256
|
]
|
|
7254
7257
|
},
|
|
7258
|
+
BlockPicture: {
|
|
7259
|
+
type: "object",
|
|
7260
|
+
properties: {
|
|
7261
|
+
name: {
|
|
7262
|
+
type: "string",
|
|
7263
|
+
enum: [
|
|
7264
|
+
"picture"
|
|
7265
|
+
]
|
|
7266
|
+
},
|
|
7267
|
+
caption: {
|
|
7268
|
+
type: "string"
|
|
7269
|
+
},
|
|
7270
|
+
link: {
|
|
7271
|
+
type: "string"
|
|
7272
|
+
},
|
|
7273
|
+
content: {
|
|
7274
|
+
type: "array",
|
|
7275
|
+
items: [
|
|
7276
|
+
{
|
|
7277
|
+
$ref: "#/definitions/Image"
|
|
7278
|
+
},
|
|
7279
|
+
{
|
|
7280
|
+
$ref: "#/definitions/BlockCaption"
|
|
7281
|
+
}
|
|
7282
|
+
],
|
|
7283
|
+
minItems: 2,
|
|
7284
|
+
maxItems: 2
|
|
7285
|
+
},
|
|
7286
|
+
type: {
|
|
7287
|
+
type: "string",
|
|
7288
|
+
enum: [
|
|
7289
|
+
"block"
|
|
7290
|
+
]
|
|
7291
|
+
},
|
|
7292
|
+
location: {
|
|
7293
|
+
$ref: "#/definitions/Location"
|
|
7294
|
+
},
|
|
7295
|
+
margin: {
|
|
7296
|
+
type: "string"
|
|
7297
|
+
},
|
|
7298
|
+
config: {
|
|
7299
|
+
type: "array",
|
|
7300
|
+
items: {
|
|
7301
|
+
anyOf: [
|
|
7302
|
+
{
|
|
7303
|
+
$ref: "#/definitions/BrokenConfigItem"
|
|
7304
|
+
},
|
|
7305
|
+
{
|
|
7306
|
+
$ref: "#/definitions/ConfigItem"
|
|
7307
|
+
}
|
|
7308
|
+
]
|
|
7309
|
+
}
|
|
7310
|
+
},
|
|
7311
|
+
id: {
|
|
7312
|
+
type: "string"
|
|
7313
|
+
}
|
|
7314
|
+
},
|
|
7315
|
+
required: [
|
|
7316
|
+
"content",
|
|
7317
|
+
"location",
|
|
7318
|
+
"margin",
|
|
7319
|
+
"name",
|
|
7320
|
+
"type"
|
|
7321
|
+
]
|
|
7322
|
+
},
|
|
7255
7323
|
RootBlock: {
|
|
7256
7324
|
type: "object",
|
|
7257
7325
|
properties: {
|
|
@@ -7971,6 +8039,9 @@ var require_AstTree = __commonJS({
|
|
|
7971
8039
|
{
|
|
7972
8040
|
$ref: "#/definitions/BlockImage"
|
|
7973
8041
|
},
|
|
8042
|
+
{
|
|
8043
|
+
$ref: "#/definitions/BlockPicture"
|
|
8044
|
+
},
|
|
7974
8045
|
{
|
|
7975
8046
|
$ref: "#/definitions/BlockCaption"
|
|
7976
8047
|
},
|
|
@@ -9346,6 +9417,9 @@ var require_PodliteDocument = __commonJS({
|
|
|
9346
9417
|
{
|
|
9347
9418
|
$ref: "#/definitions/BlockImage"
|
|
9348
9419
|
},
|
|
9420
|
+
{
|
|
9421
|
+
$ref: "#/definitions/BlockPicture"
|
|
9422
|
+
},
|
|
9349
9423
|
{
|
|
9350
9424
|
$ref: "#/definitions/BlockCaption"
|
|
9351
9425
|
},
|
|
@@ -9684,6 +9758,71 @@ var require_PodliteDocument = __commonJS({
|
|
|
9684
9758
|
"value"
|
|
9685
9759
|
]
|
|
9686
9760
|
},
|
|
9761
|
+
BlockPicture: {
|
|
9762
|
+
type: "object",
|
|
9763
|
+
properties: {
|
|
9764
|
+
name: {
|
|
9765
|
+
type: "string",
|
|
9766
|
+
enum: [
|
|
9767
|
+
"picture"
|
|
9768
|
+
]
|
|
9769
|
+
},
|
|
9770
|
+
caption: {
|
|
9771
|
+
type: "string"
|
|
9772
|
+
},
|
|
9773
|
+
link: {
|
|
9774
|
+
type: "string"
|
|
9775
|
+
},
|
|
9776
|
+
content: {
|
|
9777
|
+
type: "array",
|
|
9778
|
+
items: [
|
|
9779
|
+
{
|
|
9780
|
+
$ref: "#/definitions/Image"
|
|
9781
|
+
},
|
|
9782
|
+
{
|
|
9783
|
+
$ref: "#/definitions/BlockCaption"
|
|
9784
|
+
}
|
|
9785
|
+
],
|
|
9786
|
+
minItems: 2,
|
|
9787
|
+
maxItems: 2
|
|
9788
|
+
},
|
|
9789
|
+
type: {
|
|
9790
|
+
type: "string",
|
|
9791
|
+
enum: [
|
|
9792
|
+
"block"
|
|
9793
|
+
]
|
|
9794
|
+
},
|
|
9795
|
+
location: {
|
|
9796
|
+
$ref: "#/definitions/Location"
|
|
9797
|
+
},
|
|
9798
|
+
margin: {
|
|
9799
|
+
type: "string"
|
|
9800
|
+
},
|
|
9801
|
+
config: {
|
|
9802
|
+
type: "array",
|
|
9803
|
+
items: {
|
|
9804
|
+
anyOf: [
|
|
9805
|
+
{
|
|
9806
|
+
$ref: "#/definitions/BrokenConfigItem"
|
|
9807
|
+
},
|
|
9808
|
+
{
|
|
9809
|
+
$ref: "#/definitions/ConfigItem"
|
|
9810
|
+
}
|
|
9811
|
+
]
|
|
9812
|
+
}
|
|
9813
|
+
},
|
|
9814
|
+
id: {
|
|
9815
|
+
type: "string"
|
|
9816
|
+
}
|
|
9817
|
+
},
|
|
9818
|
+
required: [
|
|
9819
|
+
"content",
|
|
9820
|
+
"location",
|
|
9821
|
+
"margin",
|
|
9822
|
+
"name",
|
|
9823
|
+
"type"
|
|
9824
|
+
]
|
|
9825
|
+
},
|
|
9687
9826
|
RootBlock: {
|
|
9688
9827
|
type: "object",
|
|
9689
9828
|
properties: {
|
|
@@ -10403,6 +10542,9 @@ var require_PodliteDocument = __commonJS({
|
|
|
10403
10542
|
{
|
|
10404
10543
|
$ref: "#/definitions/BlockImage"
|
|
10405
10544
|
},
|
|
10545
|
+
{
|
|
10546
|
+
$ref: "#/definitions/BlockPicture"
|
|
10547
|
+
},
|
|
10406
10548
|
{
|
|
10407
10549
|
$ref: "#/definitions/BlockCaption"
|
|
10408
10550
|
},
|
|
@@ -12228,7 +12370,7 @@ var require_grammar = __commonJS({
|
|
|
12228
12370
|
}, peg$c117 = function(number) {
|
|
12229
12371
|
return parseInt(number, 10);
|
|
12230
12372
|
}, peg$c118 = function(vmargin, name, config) {
|
|
12231
|
-
return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
|
|
12373
|
+
return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
|
|
12232
12374
|
}, peg$c119 = function(vmargin, name, config, margins, ename) {
|
|
12233
12375
|
return vmargin.length === margins.length && name === ename;
|
|
12234
12376
|
}, peg$c120 = function(vmargin, name, config, margins, line) {
|
|
@@ -12377,7 +12519,7 @@ var require_grammar = __commonJS({
|
|
|
12377
12519
|
}, peg$c151 = /^[s]/, peg$c152 = peg$classExpectation(["s"], false, false), peg$c153 = function(line) {
|
|
12378
12520
|
return {text: text(), type: "ambient1"};
|
|
12379
12521
|
}, peg$c154 = function(vmargin, name) {
|
|
12380
|
-
return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
|
|
12522
|
+
return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
|
|
12381
12523
|
}, peg$c155 = function(vmargin, name, content2) {
|
|
12382
12524
|
return {
|
|
12383
12525
|
margin: vmargin,
|
|
@@ -12437,7 +12579,7 @@ var require_grammar = __commonJS({
|
|
|
12437
12579
|
margin: vmargin
|
|
12438
12580
|
};
|
|
12439
12581
|
}, peg$c168 = function(vmargin, marker, name, config) {
|
|
12440
|
-
return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
|
|
12582
|
+
return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
|
|
12441
12583
|
}, peg$c169 = function(vmargin, marker, name, config, content2) {
|
|
12442
12584
|
return {
|
|
12443
12585
|
type: "block",
|
|
@@ -17874,6 +18016,7 @@ var require_grammar = __commonJS({
|
|
|
17874
18016
|
"nested",
|
|
17875
18017
|
"output",
|
|
17876
18018
|
"para",
|
|
18019
|
+
"picture",
|
|
17877
18020
|
"pod",
|
|
17878
18021
|
"table",
|
|
17879
18022
|
"toc"
|
|
@@ -21761,7 +21904,7 @@ var require_package = __commonJS({
|
|
|
21761
21904
|
"../podlite-schema/package.json"(exports, module) {
|
|
21762
21905
|
module.exports = {
|
|
21763
21906
|
name: "@podlite/schema",
|
|
21764
|
-
version: "0.0.
|
|
21907
|
+
version: "0.0.17",
|
|
21765
21908
|
description: "AST tools for Podlite markup language",
|
|
21766
21909
|
main: "./src/index.ts",
|
|
21767
21910
|
types: "./lib/index.d.ts",
|
|
@@ -21867,8 +22010,8 @@ var dict = [
|
|
|
21867
22010
|
`
|
|
21868
22011
|
},
|
|
21869
22012
|
{
|
|
21870
|
-
displayText: "
|
|
21871
|
-
text: `=
|
|
22013
|
+
displayText: "picture \u{1F3F7}",
|
|
22014
|
+
text: `=picture https://github.com/zag/podlite-desktop/blob/master/dist-assets/linux-icon/256x256.png?raw=true
|
|
21872
22015
|
`
|
|
21873
22016
|
},
|
|
21874
22017
|
{
|
|
@@ -21900,19 +22043,19 @@ Everything else 57
|
|
|
21900
22043
|
`
|
|
21901
22044
|
},
|
|
21902
22045
|
{
|
|
21903
|
-
displayText: "
|
|
21904
|
-
text: `=begin
|
|
22046
|
+
displayText: "Mermaid diagram simple \u{1F3F7}",
|
|
22047
|
+
text: `=begin Mermaid :caption('Caption of diagram')
|
|
21905
22048
|
graph LR
|
|
21906
22049
|
A-->B
|
|
21907
22050
|
B-->C
|
|
21908
22051
|
C-->A
|
|
21909
22052
|
D-->C
|
|
21910
|
-
=end
|
|
22053
|
+
=end Mermaid
|
|
21911
22054
|
`
|
|
21912
22055
|
},
|
|
21913
22056
|
{
|
|
21914
|
-
displayText: "
|
|
21915
|
-
text: `=for
|
|
22057
|
+
displayText: "Mermaid diagram Sequence \u{1F3F7}",
|
|
22058
|
+
text: `=for Mermaid :caption('Caption of diagram')
|
|
21916
22059
|
sequenceDiagram
|
|
21917
22060
|
autonumber
|
|
21918
22061
|
Student->>Admin: Can I enrol this semester?
|
|
@@ -21927,8 +22070,8 @@ Everything else 57
|
|
|
21927
22070
|
`
|
|
21928
22071
|
},
|
|
21929
22072
|
{
|
|
21930
|
-
displayText: "
|
|
21931
|
-
text: `=for
|
|
22073
|
+
displayText: "Mermaid flowchart \u{1F3F7}",
|
|
22074
|
+
text: `=for Mermaid :caption('Caption of diagram')
|
|
21932
22075
|
graph LR
|
|
21933
22076
|
A[Square Rect] -- Link text --> B((Circle))
|
|
21934
22077
|
A --> C(Round Rect)
|
|
@@ -21938,8 +22081,8 @@ Everything else 57
|
|
|
21938
22081
|
`
|
|
21939
22082
|
},
|
|
21940
22083
|
{
|
|
21941
|
-
displayText: "
|
|
21942
|
-
text: `=for
|
|
22084
|
+
displayText: "Mermaid class \u{1F3F7}",
|
|
22085
|
+
text: `=for Mermaid :caption('Caption of diagram')
|
|
21943
22086
|
classDiagram
|
|
21944
22087
|
Person <|-- Student
|
|
21945
22088
|
Person <|-- Professor
|
|
@@ -21972,7 +22115,7 @@ Everything else 57
|
|
|
21972
22115
|
{
|
|
21973
22116
|
displayText: "code block with formatting \u{1F3F7}",
|
|
21974
22117
|
text: `=begin code :allow<I B Z>
|
|
21975
|
-
|
|
22118
|
+
{}
|
|
21976
22119
|
=end code
|
|
21977
22120
|
`
|
|
21978
22121
|
},
|
|
@@ -21989,9 +22132,9 @@ head1, head2, head3
|
|
|
21989
22132
|
`
|
|
21990
22133
|
},
|
|
21991
22134
|
{
|
|
21992
|
-
displayText: "toc (
|
|
22135
|
+
displayText: "toc ( picture, Mermaid ) + tables \u{1F3F7}",
|
|
21993
22136
|
text: `=for toc :title('List of media')
|
|
21994
|
-
|
|
22137
|
+
picture, Mermaid
|
|
21995
22138
|
=for toc :title('List of tables')
|
|
21996
22139
|
table
|
|
21997
22140
|
|
|
@@ -22032,7 +22175,7 @@ table
|
|
|
22032
22175
|
lang: "md"
|
|
22033
22176
|
},
|
|
22034
22177
|
{
|
|
22035
|
-
displayText: "
|
|
22178
|
+
displayText: "picture \u{1F3F7}",
|
|
22036
22179
|
text: `
|
|
22037
22180
|
|
|
22038
22181
|
`,
|
|
@@ -22049,8 +22192,8 @@ table
|
|
|
22049
22192
|
lang: "md"
|
|
22050
22193
|
},
|
|
22051
22194
|
{
|
|
22052
|
-
displayText: "
|
|
22053
|
-
text: `\`\`\`
|
|
22195
|
+
displayText: "Mermaid simple \u{1F3F7}",
|
|
22196
|
+
text: `\`\`\`mermaid
|
|
22054
22197
|
graph LR
|
|
22055
22198
|
A-->B
|
|
22056
22199
|
B-->C
|
|
@@ -22068,6 +22211,10 @@ import {useState, useEffect, useRef} from "react";
|
|
|
22068
22211
|
import "codemirror/mode/gfm/gfm";
|
|
22069
22212
|
import "codemirror/addon/hint/show-hint";
|
|
22070
22213
|
import "codemirror/addon/hint/show-hint.css";
|
|
22214
|
+
import "codemirror/addon/search/search";
|
|
22215
|
+
import "codemirror/addon/search/searchcursor";
|
|
22216
|
+
import "codemirror/addon/dialog/dialog";
|
|
22217
|
+
import "codemirror/addon/dialog/dialog.css";
|
|
22071
22218
|
|
|
22072
22219
|
// ../podlite-schema/src/index.ts
|
|
22073
22220
|
var import_ajv = __toModule(require_ajv());
|
|
@@ -22701,6 +22848,9 @@ var toAnyRules = (method, allplugins) => {
|
|
|
22701
22848
|
};
|
|
22702
22849
|
|
|
22703
22850
|
// ../podlite-schema/src/helpers/ids.ts
|
|
22851
|
+
var slugifyText = (text) => {
|
|
22852
|
+
return text.trim().replace(/\s+/g, "-").replace(/[\]\[\!\/\'\"\#\$\%\&\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\{\|\}\~\`。,、;:?!…—·ˉ¨‘’“”々~‖∶"'`|〃〔〕〈〉《》「」『』.〖〗【】()[]{}]/g, "").replace(/^\-+/, "");
|
|
22853
|
+
};
|
|
22704
22854
|
var middleware = () => (tree) => {
|
|
22705
22855
|
const transformerBlocks = makeTransformer({
|
|
22706
22856
|
"*": (node, ctx, visiter) => {
|
|
@@ -22709,7 +22859,7 @@ var middleware = () => (tree) => {
|
|
|
22709
22859
|
if (node2.name == "caption") {
|
|
22710
22860
|
return node2;
|
|
22711
22861
|
} else if (node2.name == "head") {
|
|
22712
|
-
return {...node2, id: getTextContentFromNode(node2)
|
|
22862
|
+
return {...node2, id: slugifyText(getTextContentFromNode(node2))};
|
|
22713
22863
|
} else {
|
|
22714
22864
|
return {...node2, id: nanoid()};
|
|
22715
22865
|
}
|
|
@@ -22866,8 +23016,9 @@ var middle2 = () => (tree) => {
|
|
|
22866
23016
|
const isCodeBlock = "name" in n && n.name === "code";
|
|
22867
23017
|
const isDataBlock = "name" in n && n.name === "data";
|
|
22868
23018
|
const isMarkdownBlock = "name" in n && n.name === "markdown";
|
|
23019
|
+
const isPictureBlock = "name" in n && n.name === "picture";
|
|
22869
23020
|
const allowValues = conf.getAllValues("allow");
|
|
22870
|
-
if ((isCodeBlock || isDataBlock || isMarkdownBlock) && allowValues.length == 0)
|
|
23021
|
+
if ((isCodeBlock || isDataBlock || isMarkdownBlock || isPictureBlock) && allowValues.length == 0)
|
|
22871
23022
|
return n;
|
|
22872
23023
|
const allowed = allowValues.sort();
|
|
22873
23024
|
const transformer = makeTransformer_default({
|
|
@@ -23532,7 +23683,7 @@ var parse4 = (str) => {
|
|
|
23532
23683
|
};
|
|
23533
23684
|
var getSuggestionContextForLine = (pod, line) => {
|
|
23534
23685
|
const tree = parse4(pod);
|
|
23535
|
-
const markdownBlocks = getFromTree(tree, "Markdown");
|
|
23686
|
+
const markdownBlocks = getFromTree(tree, "Markdown", "markdown");
|
|
23536
23687
|
const isMd = markdownBlocks.findIndex(({
|
|
23537
23688
|
location: {
|
|
23538
23689
|
start: {line: lineStart},
|