@gravity-ui/markdown-editor 13.6.0 → 13.7.0
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/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/TooltipView.css +26 -0
- package/build/cjs/extensions/markdown/Table/plugins/TableCellContextPlugin/floating.css +11 -0
- package/build/cjs/extensions/yfm/FoldingHeading/plugins/folding.css +51 -0
- package/build/cjs/extensions/yfm/ImgSize/ImagePaste/skeleton.css +8 -0
- package/build/cjs/extensions/yfm/ImgSize/ImageWidget/view.css +12 -0
- package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImageForm/ImageForm.css +8 -0
- package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgNodeView.css +4 -0
- package/build/cjs/extensions/yfm/Mermaid/MermaidNodeView/Mermaid.css +33 -0
- package/build/cjs/extensions/yfm/YfmCut/nodeviews/yfm-cut-title.css +3 -0
- package/build/cjs/extensions/yfm/YfmFile/YfmFilePaste/skeleton.css +8 -0
- package/build/cjs/extensions/yfm/YfmFile/YfmFileWidget/view.css +7 -0
- package/build/cjs/extensions/yfm/YfmHtmlBlock/YfmHtmlBlockNodeView/YfmHtmlBlock.css +66 -0
- package/build/cjs/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.css +66 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/view.css +83 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.css +37 -0
- package/build/cjs/markup/codemirror/search-plugin/view/SearchPopup.css +9 -0
- package/build/cjs/markup/codemirror/yfm.d.ts +9 -2
- package/build/cjs/markup/codemirror/yfm.js +55 -51
- package/build/cjs/version.js +1 -1
- package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/TooltipView.css +26 -0
- package/build/esm/extensions/markdown/Table/plugins/TableCellContextPlugin/floating.css +11 -0
- package/build/esm/extensions/yfm/FoldingHeading/plugins/folding.css +51 -0
- package/build/esm/extensions/yfm/ImgSize/ImagePaste/skeleton.css +8 -0
- package/build/esm/extensions/yfm/ImgSize/ImageWidget/view.css +12 -0
- package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImageForm/ImageForm.css +8 -0
- package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgNodeView.css +4 -0
- package/build/esm/extensions/yfm/Mermaid/MermaidNodeView/Mermaid.css +33 -0
- package/build/esm/extensions/yfm/YfmCut/nodeviews/yfm-cut-title.css +3 -0
- package/build/esm/extensions/yfm/YfmFile/YfmFilePaste/skeleton.css +8 -0
- package/build/esm/extensions/yfm/YfmFile/YfmFileWidget/view.css +7 -0
- package/build/esm/extensions/yfm/YfmHtmlBlock/YfmHtmlBlockNodeView/YfmHtmlBlock.css +66 -0
- package/build/esm/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.css +66 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/view.css +83 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.css +37 -0
- package/build/esm/markup/codemirror/search-plugin/view/SearchPopup.css +9 -0
- package/build/esm/markup/codemirror/yfm.d.ts +9 -2
- package/build/esm/markup/codemirror/yfm.js +55 -51
- package/build/esm/version.js +1 -1
- package/build/styles.css +432 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.pm-h-folding-hidden {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pm-h-folding-content {
|
|
6
|
+
padding-left: 28px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.pm-h-folding-separator {
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
.pm-h-folding-separator::before {
|
|
13
|
+
position: absolute;
|
|
14
|
+
z-index: 1;
|
|
15
|
+
bottom: -4px;
|
|
16
|
+
left: 0;
|
|
17
|
+
width: 12px;
|
|
18
|
+
height: 12px;
|
|
19
|
+
content: "";
|
|
20
|
+
background-color: var(--g-color-text-secondary);
|
|
21
|
+
mask-image: url('data:image/svg+xml;svg,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M2 7.25a.75.75 0 0 0 0 1.5h5.69l-2.72 2.72a.75.75 0 1 0 1.06 1.06l4-4a.75.75 0 0 0 0-1.06l-4-4a.75.75 0 0 0-1.06 1.06l2.72 2.72zm7.47 4.22a.75.75 0 1 0 1.06 1.06l4-4a.75.75 0 0 0 0-1.06l-4-4a.75.75 0 1 0-1.06 1.06L12.94 8z" clip-rule="evenodd"/></svg>');
|
|
22
|
+
mask-size: 12px;
|
|
23
|
+
transform: translateY(80%);
|
|
24
|
+
}
|
|
25
|
+
.pm-h-folding-separator::after {
|
|
26
|
+
position: absolute;
|
|
27
|
+
z-index: 1;
|
|
28
|
+
bottom: -8px;
|
|
29
|
+
left: 16px;
|
|
30
|
+
display: block;
|
|
31
|
+
width: calc(100% - 16px - 56px - 6px);
|
|
32
|
+
content: "";
|
|
33
|
+
border-top: 1px dashed var(--g-color-line-generic);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.pm-h-folding-label::after {
|
|
37
|
+
position: absolute;
|
|
38
|
+
z-index: 1;
|
|
39
|
+
right: 2px;
|
|
40
|
+
bottom: -6px;
|
|
41
|
+
display: block;
|
|
42
|
+
padding: 0 8px;
|
|
43
|
+
content: attr(data-value);
|
|
44
|
+
color: var(--g-color-text-misc);
|
|
45
|
+
border-radius: 4px;
|
|
46
|
+
background-color: var(--g-color-base-misc-medium-hover);
|
|
47
|
+
transform: translate(0, 50%);
|
|
48
|
+
font-size: var(--g-text-body-1-font-size);
|
|
49
|
+
line-height: var(--g-text-body-1-line-height);
|
|
50
|
+
font-weight: var(--g-text-body-font-weight);
|
|
51
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.g-md-image-placeholder {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
column-gap: 8px;
|
|
5
|
+
min-width: 300px;
|
|
6
|
+
padding: 12px 20px;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
background-color: var(--g-color-base-simple-hover-solid);
|
|
9
|
+
font-size: var(--g-text-body-2-font-size);
|
|
10
|
+
line-height: var(--g-text-body-2-line-height);
|
|
11
|
+
font-weight: var(--g-text-body-font-weight);
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.g-md-Mermaid {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
margin-bottom: 15px;
|
|
5
|
+
padding: 2px;
|
|
6
|
+
border: 1px solid var(--g-color-line-generic);
|
|
7
|
+
border-radius: var(--g-border-radius-m);
|
|
8
|
+
}
|
|
9
|
+
.g-md-Mermaid_edit {
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
.g-md-Mermaid__Preview {
|
|
13
|
+
flex: 1;
|
|
14
|
+
}
|
|
15
|
+
.g-md-Mermaid__Error {
|
|
16
|
+
flex: 1;
|
|
17
|
+
font-family: var(--g-font-family-monospace);
|
|
18
|
+
color: var(--g-color-text-danger);
|
|
19
|
+
}
|
|
20
|
+
.g-md-Mermaid__Editor {
|
|
21
|
+
flex: 1;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
caret-color: auto;
|
|
24
|
+
}
|
|
25
|
+
.g-md-Mermaid__EditorPopover {
|
|
26
|
+
z-index: 1;
|
|
27
|
+
float: right;
|
|
28
|
+
}
|
|
29
|
+
.g-md-Mermaid__Controls {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: end;
|
|
32
|
+
margin-top: 5px;
|
|
33
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.g-md-yfm-html-block {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
margin-bottom: 15px;
|
|
6
|
+
padding-top: 28px;
|
|
7
|
+
border: 1px solid var(--g-color-line-generic);
|
|
8
|
+
border-radius: var(--g-border-radius-m);
|
|
9
|
+
}
|
|
10
|
+
.g-md-yfm-html-block_editing {
|
|
11
|
+
display: flex;
|
|
12
|
+
padding-top: 0;
|
|
13
|
+
border: 0;
|
|
14
|
+
}
|
|
15
|
+
.g-md-yfm-html-block__label {
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: 8px;
|
|
18
|
+
left: 8px;
|
|
19
|
+
}
|
|
20
|
+
.g-md-yfm-html-block__menu {
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
right: 0;
|
|
24
|
+
}
|
|
25
|
+
.g-md-yfm-html-block__preview {
|
|
26
|
+
flex: 1;
|
|
27
|
+
}
|
|
28
|
+
.g-md-yfm-html-block__error {
|
|
29
|
+
flex: 1;
|
|
30
|
+
font-family: var(--g-font-family-monospace);
|
|
31
|
+
color: var(--g-color-text-danger);
|
|
32
|
+
}
|
|
33
|
+
.g-md-yfm-html-block__editor {
|
|
34
|
+
flex: 1;
|
|
35
|
+
width: 50%;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
caret-color: auto;
|
|
38
|
+
}
|
|
39
|
+
.g-md-yfm-html-block__editor .g-text-area__content {
|
|
40
|
+
font-size: 1em;
|
|
41
|
+
color: var(--yfm-color-hljs-subst);
|
|
42
|
+
border: 0;
|
|
43
|
+
border-radius: var(--g-border-radius-m);
|
|
44
|
+
background: var(--yfm-color-hljs-background);
|
|
45
|
+
font-feature-settings: normal;
|
|
46
|
+
}
|
|
47
|
+
.g-md-yfm-html-block__editor .g-text-area__control.g-md-YfmHtmlBlockHelper {
|
|
48
|
+
font-family: var(--yfm-font-family-monospace);
|
|
49
|
+
}
|
|
50
|
+
.g-md-yfm-html-block__editor-popover {
|
|
51
|
+
z-index: 1;
|
|
52
|
+
float: right;
|
|
53
|
+
}
|
|
54
|
+
.g-md-yfm-html-block__controls {
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: end;
|
|
57
|
+
margin-top: 5px;
|
|
58
|
+
}
|
|
59
|
+
.g-md-yfm-html-block__content {
|
|
60
|
+
flex-grow: 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.g-root_theme_dark-hc .g-md-yfm-html-block_editing .g-text-area__content,
|
|
64
|
+
.g-root_theme_dark .g-md-yfm-html-block_editing .g-text-area__content {
|
|
65
|
+
color: var(--g-color-text-primary);
|
|
66
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.yfm .yfm-note {
|
|
2
|
+
max-width: 1296px;
|
|
3
|
+
margin: 20px 0;
|
|
4
|
+
padding: 20px 20px 20px 64px;
|
|
5
|
+
border-radius: 10px;
|
|
6
|
+
}
|
|
7
|
+
.yfm .yfm-note .yfm-note-title {
|
|
8
|
+
font-weight: 700;
|
|
9
|
+
}
|
|
10
|
+
.yfm .yfm-note > p {
|
|
11
|
+
margin: 0 0 10px 0;
|
|
12
|
+
}
|
|
13
|
+
.yfm .yfm-note > p:first-child::before {
|
|
14
|
+
box-sizing: content-box;
|
|
15
|
+
display: block;
|
|
16
|
+
width: 24px;
|
|
17
|
+
height: 24px;
|
|
18
|
+
margin-top: -2px;
|
|
19
|
+
margin-left: -44px;
|
|
20
|
+
padding-right: 20px;
|
|
21
|
+
float: left;
|
|
22
|
+
}
|
|
23
|
+
.yfm .yfm-note > p:last-child {
|
|
24
|
+
margin-bottom: 0;
|
|
25
|
+
}
|
|
26
|
+
.yfm .yfm-note.yfm-accent-info > p:first-child::before {
|
|
27
|
+
content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="rgb(2,123,243)"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
|
|
28
|
+
}
|
|
29
|
+
.yfm .yfm-note.yfm-accent-tip > p:first-child::before {
|
|
30
|
+
content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="rgb(86,189,103)"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
|
|
31
|
+
}
|
|
32
|
+
.yfm .yfm-note.yfm-accent-alert > p:first-child::before {
|
|
33
|
+
content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="rgb(255,70,69)"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
|
|
34
|
+
}
|
|
35
|
+
.yfm .yfm-note.yfm-accent-warning > p:first-child::before {
|
|
36
|
+
content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="rgb(241,149,24)"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
|
|
37
|
+
}
|
|
38
|
+
.yfm .yfm-note.yfm-accent-info {
|
|
39
|
+
background: rgba(2, 123, 243, 0.08);
|
|
40
|
+
}
|
|
41
|
+
.yfm .yfm-note.yfm-accent-tip {
|
|
42
|
+
background: rgba(63, 201, 46, 0.1);
|
|
43
|
+
}
|
|
44
|
+
.yfm .yfm-note.yfm-accent-alert {
|
|
45
|
+
background: rgba(235, 50, 38, 0.08);
|
|
46
|
+
}
|
|
47
|
+
.yfm .yfm-note.yfm-accent-warning {
|
|
48
|
+
background: rgba(255, 136, 0, 0.15);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.g-md-yfm-note-toolbar {
|
|
52
|
+
margin: 2px 8px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.g-md-toolbar-group__s-button_id_note-type-tip {
|
|
56
|
+
color: #56bd67;
|
|
57
|
+
}
|
|
58
|
+
.g-md-toolbar-group__s-button_id_note-type-info {
|
|
59
|
+
color: #027bf3;
|
|
60
|
+
}
|
|
61
|
+
.g-md-toolbar-group__s-button_id_note-type-alert {
|
|
62
|
+
color: #ff4645;
|
|
63
|
+
}
|
|
64
|
+
.g-md-toolbar-group__s-button_id_note-type-warning {
|
|
65
|
+
color: #f19518;
|
|
66
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.g-md-table-view__hack-strip {
|
|
2
|
+
position: absolute;
|
|
3
|
+
left: -13px;
|
|
4
|
+
display: block;
|
|
5
|
+
width: 13px;
|
|
6
|
+
height: 100%;
|
|
7
|
+
background: transparent;
|
|
8
|
+
}
|
|
9
|
+
.g-md-table-view__wrapper {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: inline-block;
|
|
12
|
+
max-width: calc(100% - 18px);
|
|
13
|
+
margin-right: 18px;
|
|
14
|
+
/* stylelint-disable declaration-no-important */
|
|
15
|
+
margin-bottom: 18px !important;
|
|
16
|
+
}
|
|
17
|
+
.g-md-table-view__buttons-visible .g-md-table-view__plus-button-controls {
|
|
18
|
+
pointer-events: initial;
|
|
19
|
+
opacity: 1;
|
|
20
|
+
}
|
|
21
|
+
.g-md-table-view__plus-button-controls {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
opacity: 0;
|
|
24
|
+
transition: opacity 150ms ease 50ms;
|
|
25
|
+
}
|
|
26
|
+
.g-md-table-view__plus-button-controls_right {
|
|
27
|
+
position: absolute;
|
|
28
|
+
z-index: 100;
|
|
29
|
+
top: 0;
|
|
30
|
+
right: -18px;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
width: 16px;
|
|
34
|
+
height: 100%;
|
|
35
|
+
}
|
|
36
|
+
.g-md-table-view__plus-button-controls_bottom {
|
|
37
|
+
position: absolute;
|
|
38
|
+
z-index: 100;
|
|
39
|
+
bottom: -18px;
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 16px;
|
|
44
|
+
}
|
|
45
|
+
.g-md-table-view__plus-button {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
height: 100%;
|
|
50
|
+
}
|
|
51
|
+
.g-md-table-view__plus-button_right {
|
|
52
|
+
width: 16px;
|
|
53
|
+
height: 100%;
|
|
54
|
+
}
|
|
55
|
+
.g-md-table-view__plus-button_bottom {
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 16px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.g-md-table-view.g-md-table-view {
|
|
61
|
+
z-index: unset;
|
|
62
|
+
display: block;
|
|
63
|
+
overflow: auto;
|
|
64
|
+
box-sizing: content-box;
|
|
65
|
+
width: fit-content;
|
|
66
|
+
margin: -13px 0 0 -13px;
|
|
67
|
+
padding: 13px 0 0 13px;
|
|
68
|
+
border: none;
|
|
69
|
+
border-radius: 0;
|
|
70
|
+
background: transparent !important;
|
|
71
|
+
}
|
|
72
|
+
.g-md-table-view.g-md-table-view tbody {
|
|
73
|
+
display: block;
|
|
74
|
+
border-radius: 8px;
|
|
75
|
+
background: var(--g-color-base-background);
|
|
76
|
+
box-shadow: inset 0 0 0 1px var(--g-color-line-generic);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.g-md-table-wrapper {
|
|
80
|
+
display: inline-block;
|
|
81
|
+
width: 100%;
|
|
82
|
+
margin-right: 2px;
|
|
83
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.g-md-table-cell-view__left-button {
|
|
2
|
+
position: absolute;
|
|
3
|
+
z-index: 110;
|
|
4
|
+
top: calc(50% - 14px);
|
|
5
|
+
left: -13px;
|
|
6
|
+
pointer-events: none;
|
|
7
|
+
opacity: 0;
|
|
8
|
+
border-radius: var(--g-border-radius-s);
|
|
9
|
+
background: var(--g-color-base-background);
|
|
10
|
+
}
|
|
11
|
+
.g-md-table-cell-view__left-button:hover {
|
|
12
|
+
pointer-events: initial;
|
|
13
|
+
opacity: 1;
|
|
14
|
+
}
|
|
15
|
+
.g-md-table-cell-view__upper-button {
|
|
16
|
+
position: absolute;
|
|
17
|
+
z-index: 110;
|
|
18
|
+
top: -13px;
|
|
19
|
+
left: calc(50% - 14px);
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
opacity: 0;
|
|
22
|
+
border-radius: var(--g-border-radius-s);
|
|
23
|
+
background: var(--g-color-base-background);
|
|
24
|
+
transform: rotate(90deg);
|
|
25
|
+
}
|
|
26
|
+
.g-md-table-cell-view__upper-button:hover {
|
|
27
|
+
pointer-events: initial;
|
|
28
|
+
opacity: 1;
|
|
29
|
+
}
|
|
30
|
+
.g-md-table-cell-view__upper-visible .g-md-table-cell-view__upper-button {
|
|
31
|
+
pointer-events: initial;
|
|
32
|
+
opacity: 1;
|
|
33
|
+
}
|
|
34
|
+
.g-md-table-cell-view__left-visible .g-md-table-cell-view__left-button {
|
|
35
|
+
pointer-events: initial;
|
|
36
|
+
opacity: 1;
|
|
37
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Completion, snippet } from '@codemirror/autocomplete';
|
|
1
|
+
import { Completion, CompletionSource, snippet } from '@codemirror/autocomplete';
|
|
2
2
|
import type { Extension } from '@codemirror/state';
|
|
3
3
|
import { Tag } from '@lezer/highlight';
|
|
4
4
|
export declare const customTags: {
|
|
@@ -15,4 +15,11 @@ export declare const yfmCutSnippet: (editor: {
|
|
|
15
15
|
state: import("@codemirror/state").EditorState;
|
|
16
16
|
dispatch: (tr: import("@codemirror/state").Transaction) => void;
|
|
17
17
|
}, completion: Completion | null, from: number, to: number) => void;
|
|
18
|
-
export
|
|
18
|
+
export interface LanguageData {
|
|
19
|
+
autocomplete: CompletionSource;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
export interface YfmLangOptions {
|
|
23
|
+
languageData?: LanguageData[];
|
|
24
|
+
}
|
|
25
|
+
export declare function yfmLang({ languageData }?: YfmLangOptions): Extension;
|
|
@@ -54,7 +54,56 @@ export const yfmNoteSnippets = {
|
|
|
54
54
|
};
|
|
55
55
|
export const yfmCutSnippetTemplate = '{% cut "#{title}" %}\n\n#{}\n\n{% endcut %}\n\n';
|
|
56
56
|
export const yfmCutSnippet = snippet(yfmCutSnippetTemplate);
|
|
57
|
-
|
|
57
|
+
const mdAutocomplete = {
|
|
58
|
+
autocomplete: (context) => {
|
|
59
|
+
// TODO: add more actions and re-enable
|
|
60
|
+
// let word = context.matchBefore(/\/.*/);
|
|
61
|
+
// if (word) {
|
|
62
|
+
// return {
|
|
63
|
+
// from: word.from,
|
|
64
|
+
// options: [
|
|
65
|
+
// ...yfmNoteTypes.map<Completion>((type, index) => ({
|
|
66
|
+
// label: `/yfm note ${type}`,
|
|
67
|
+
// displayLabel: `YFM Note ${capitalize(type)}`,
|
|
68
|
+
// type: 'text',
|
|
69
|
+
// apply: yfmNoteSnippets[type],
|
|
70
|
+
// boost: -index,
|
|
71
|
+
// })),
|
|
72
|
+
// {
|
|
73
|
+
// label: '/yfm cut',
|
|
74
|
+
// displayLabel: 'YFM Cut',
|
|
75
|
+
// type: 'text',
|
|
76
|
+
// apply: yfmCutSnippet,
|
|
77
|
+
// },
|
|
78
|
+
// ],
|
|
79
|
+
// };
|
|
80
|
+
// }
|
|
81
|
+
const word = context.matchBefore(/^.*/);
|
|
82
|
+
if (word === null || word === void 0 ? void 0 : word.text.startsWith('{%')) {
|
|
83
|
+
return {
|
|
84
|
+
from: word.from,
|
|
85
|
+
options: [
|
|
86
|
+
...yfmNoteTypes.map((type, index) => ({
|
|
87
|
+
label: `{% note ${type}`,
|
|
88
|
+
displayLabel: capitalize(type),
|
|
89
|
+
type: 'text',
|
|
90
|
+
section: 'YFM Note',
|
|
91
|
+
apply: yfmNoteSnippets[type],
|
|
92
|
+
boost: -index,
|
|
93
|
+
})),
|
|
94
|
+
{
|
|
95
|
+
label: '{% cut',
|
|
96
|
+
displayLabel: 'YFM Cut',
|
|
97
|
+
type: 'text',
|
|
98
|
+
apply: yfmCutSnippet,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
export function yfmLang({ languageData = [] } = {}) {
|
|
58
107
|
const mdSupport = markdown({
|
|
59
108
|
// defaultCodeLanguage: markdownLanguage,
|
|
60
109
|
base: markdownLanguage,
|
|
@@ -62,54 +111,9 @@ export function yfmLang() {
|
|
|
62
111
|
completeHTMLTags: false,
|
|
63
112
|
extensions: [UnderlineExtension, MonospaceExtension, MarkedExtension],
|
|
64
113
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// return {
|
|
71
|
-
// from: word.from,
|
|
72
|
-
// options: [
|
|
73
|
-
// ...yfmNoteTypes.map<Completion>((type, index) => ({
|
|
74
|
-
// label: `/yfm note ${type}`,
|
|
75
|
-
// displayLabel: `YFM Note ${capitalize(type)}`,
|
|
76
|
-
// type: 'text',
|
|
77
|
-
// apply: yfmNoteSnippets[type],
|
|
78
|
-
// boost: -index,
|
|
79
|
-
// })),
|
|
80
|
-
// {
|
|
81
|
-
// label: '/yfm cut',
|
|
82
|
-
// displayLabel: 'YFM Cut',
|
|
83
|
-
// type: 'text',
|
|
84
|
-
// apply: yfmCutSnippet,
|
|
85
|
-
// },
|
|
86
|
-
// ],
|
|
87
|
-
// };
|
|
88
|
-
// }
|
|
89
|
-
const word = context.matchBefore(/^.*/);
|
|
90
|
-
if (word === null || word === void 0 ? void 0 : word.text.startsWith('{%')) {
|
|
91
|
-
return {
|
|
92
|
-
from: word.from,
|
|
93
|
-
options: [
|
|
94
|
-
...yfmNoteTypes.map((type, index) => ({
|
|
95
|
-
label: `{% note ${type}`,
|
|
96
|
-
displayLabel: capitalize(type),
|
|
97
|
-
type: 'text',
|
|
98
|
-
section: 'YFM Note',
|
|
99
|
-
apply: yfmNoteSnippets[type],
|
|
100
|
-
boost: -index,
|
|
101
|
-
})),
|
|
102
|
-
{
|
|
103
|
-
label: '{% cut',
|
|
104
|
-
displayLabel: 'YFM Cut',
|
|
105
|
-
type: 'text',
|
|
106
|
-
apply: yfmCutSnippet,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return null;
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
return [mdSupport, mdSupport.language.data.of(mdAutocomplete)];
|
|
114
|
+
return [
|
|
115
|
+
mdSupport,
|
|
116
|
+
mdSupport.language.data.of(mdAutocomplete),
|
|
117
|
+
languageData.map((item) => mdSupport.language.data.of(item)),
|
|
118
|
+
];
|
|
115
119
|
}
|
package/build/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** During build process, the current version will be injected here */
|
|
2
|
-
export const VERSION = typeof '13.
|
|
2
|
+
export const VERSION = typeof '13.7.0' !== 'undefined' ? '13.7.0' : 'unknown';
|