@type32/codemirror-rich-obsidian-editor 0.1.9 → 0.1.14

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.
Files changed (139) hide show
  1. package/dist/module.json +3 -3
  2. package/dist/module.mjs +11 -8
  3. package/dist/runtime/assets/css/editor.css +1 -0
  4. package/dist/runtime/components/CodeEditor.client.d.vue.ts +38 -0
  5. package/dist/runtime/components/CodeEditor.client.vue +207 -0
  6. package/dist/runtime/components/CodeEditor.client.vue.d.ts +38 -0
  7. package/dist/runtime/components/Editor/ImageEmbedComponent.d.vue.ts +7 -0
  8. package/dist/runtime/components/Editor/ImageEmbedComponent.vue +14 -0
  9. package/dist/runtime/components/Editor/ImageEmbedComponent.vue.d.ts +7 -0
  10. package/dist/runtime/components/Editor/TestCustomCodeBlock.d.vue.ts +6 -0
  11. package/dist/runtime/components/Editor/TestCustomCodeBlock.vue +17 -0
  12. package/dist/runtime/components/Editor/TestCustomCodeBlock.vue.d.ts +6 -0
  13. package/dist/runtime/components/Editor.client.d.vue.ts +29 -0
  14. package/dist/runtime/components/Editor.client.vue +210 -0
  15. package/dist/runtime/components/Editor.client.vue.d.ts +29 -0
  16. package/dist/runtime/composables/useAlfaaz.d.ts +8 -0
  17. package/dist/runtime/composables/useAlfaaz.js +70 -0
  18. package/dist/runtime/composables/useDocumentUtils.d.ts +12 -0
  19. package/dist/runtime/composables/useDocumentUtils.js +90 -0
  20. package/dist/runtime/composables/useEditorFrontmatter.d.ts +11 -0
  21. package/dist/runtime/composables/useEditorFrontmatter.js +61 -0
  22. package/dist/runtime/composables/useEditorUtils.d.ts +31 -0
  23. package/dist/runtime/composables/useEditorUtils.js +162 -0
  24. package/dist/runtime/editor/lezer-parsers/customOFMParsers.d.ts +1 -0
  25. package/dist/runtime/editor/lezer-parsers/customOFMParsers.js +23 -0
  26. package/dist/runtime/editor/lezer-parsers/lezerCalloutParser.d.ts +8 -0
  27. package/dist/runtime/editor/lezer-parsers/lezerCalloutParser.js +53 -0
  28. package/dist/runtime/editor/lezer-parsers/lezerHashtagParser.d.ts +6 -0
  29. package/dist/runtime/editor/lezer-parsers/lezerHashtagParser.js +35 -0
  30. package/dist/runtime/editor/lezer-parsers/lezerIndentationParser.d.ts +4 -0
  31. package/dist/runtime/editor/lezer-parsers/lezerIndentationParser.js +23 -0
  32. package/dist/runtime/editor/lezer-parsers/lezerInternalLinkParser.d.ts +10 -0
  33. package/dist/runtime/editor/lezer-parsers/lezerInternalLinkParser.js +110 -0
  34. package/dist/runtime/editor/lezer-parsers/lezerLatexParser.d.ts +7 -0
  35. package/dist/runtime/editor/lezer-parsers/lezerLatexParser.js +75 -0
  36. package/dist/runtime/editor/lezer-parsers/lezerYamlFrontmatterParser.d.ts +13 -0
  37. package/dist/runtime/editor/lezer-parsers/lezerYamlFrontmatterParser.js +55 -0
  38. package/dist/runtime/editor/plugins/codemirror-editor-plugins/customBracketClosingPlugin.d.ts +4 -0
  39. package/dist/runtime/editor/plugins/codemirror-editor-plugins/customBracketClosingPlugin.js +94 -0
  40. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorAttributesPlugin.d.ts +8 -0
  41. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorAttributesPlugin.js +136 -0
  42. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorInternalLinkAutocompletePlugin.d.ts +1 -0
  43. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorInternalLinkAutocompletePlugin.js +61 -0
  44. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorKeymapPlugin.d.ts +1 -0
  45. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorKeymapPlugin.js +95 -0
  46. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorKeywordSearchPlugin.d.ts +5 -0
  47. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorKeywordSearchPlugin.js +38 -0
  48. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorLinkClickPlugin.d.ts +1 -0
  49. package/dist/runtime/editor/plugins/codemirror-editor-plugins/editorLinkClickPlugin.js +59 -0
  50. package/dist/runtime/editor/plugins/codemirror-editor-plugins/indentationGuidesPlugin.d.ts +10 -0
  51. package/dist/runtime/editor/plugins/codemirror-editor-plugins/indentationGuidesPlugin.js +121 -0
  52. package/dist/runtime/editor/plugins/codemirror-editor-plugins/indentationListPlugin.d.ts +5 -0
  53. package/dist/runtime/editor/plugins/codemirror-editor-plugins/indentationListPlugin.js +66 -0
  54. package/dist/runtime/editor/plugins/codemirror-plugin-proses/createProsePlugin.d.ts +53 -0
  55. package/dist/runtime/editor/plugins/codemirror-plugin-proses/createProsePlugin.js +23 -0
  56. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseCalloutPlugin.d.ts +3 -0
  57. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseCalloutPlugin.js +94 -0
  58. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseCodeBlockCodemirrorViewPlugin.d.ts +3 -0
  59. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseCodeBlockCodemirrorViewPlugin.js +128 -0
  60. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseHashtagCodemirrorViewPlugin.d.ts +1 -0
  61. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseHashtagCodemirrorViewPlugin.js +19 -0
  62. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseHighlightCodemirrorViewPlugin.d.ts +3 -0
  63. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseHighlightCodemirrorViewPlugin.js +51 -0
  64. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseInternalLinkCodemirrorViewPlugin.d.ts +3 -0
  65. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseInternalLinkCodemirrorViewPlugin.js +142 -0
  66. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseLatexCodemirrorViewPlugin.d.ts +2 -0
  67. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseLatexCodemirrorViewPlugin.js +160 -0
  68. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseLinkCodemirrorViewPlugin.d.ts +3 -0
  69. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseLinkCodemirrorViewPlugin.js +102 -0
  70. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseQuoteblockCodemirrorViewPlugin.d.ts +3 -0
  71. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseQuoteblockCodemirrorViewPlugin.js +76 -0
  72. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseTaskListPlugin.d.ts +8 -0
  73. package/dist/runtime/editor/plugins/codemirror-plugin-proses/proseTaskListPlugin.js +106 -0
  74. package/dist/runtime/editor/plugins/codemirror-widgets/proseCalloutWidget.d.ts +11 -0
  75. package/dist/runtime/editor/plugins/codemirror-widgets/proseCalloutWidget.js +84 -0
  76. package/dist/runtime/editor/plugins/codemirror-widgets/proseCodeBlockWidgets.d.ts +15 -0
  77. package/dist/runtime/editor/plugins/codemirror-widgets/proseCodeBlockWidgets.js +53 -0
  78. package/dist/runtime/editor/plugins/codemirror-widgets/proseLatexWidgets.d.ts +11 -0
  79. package/dist/runtime/editor/plugins/codemirror-widgets/proseLatexWidgets.js +50 -0
  80. package/dist/runtime/editor/plugins/codemirror-widgets/proseVueComponentEmbedWidget.d.ts +15 -0
  81. package/dist/runtime/editor/plugins/codemirror-widgets/proseVueComponentEmbedWidget.js +58 -0
  82. package/dist/runtime/editor/plugins/customBracketClosingConfig.d.ts +2 -0
  83. package/dist/runtime/editor/plugins/customBracketClosingConfig.js +4 -0
  84. package/dist/runtime/editor/plugins/lezerStylesHighlightingPlugin.d.ts +3 -0
  85. package/dist/runtime/editor/plugins/lezerStylesHighlightingPlugin.js +56 -0
  86. package/dist/runtime/editor/plugins/linkMappingConfig.d.ts +3 -0
  87. package/dist/runtime/editor/plugins/linkMappingConfig.js +4 -0
  88. package/dist/runtime/editor/plugins/richTextPlugin.d.ts +10 -0
  89. package/dist/runtime/editor/plugins/richTextPlugin.js +107 -0
  90. package/dist/runtime/editor/plugins/specialCodeBlockMappingConfig.d.ts +3 -0
  91. package/dist/runtime/editor/plugins/specialCodeBlockMappingConfig.js +4 -0
  92. package/dist/runtime/editor/types/editor-types.d.ts +115 -0
  93. package/dist/runtime/editor/utility/decorations.d.ts +9 -0
  94. package/dist/runtime/editor/utility/decorations.js +9 -0
  95. package/dist/runtime/editor/utility/tools.d.ts +12 -0
  96. package/dist/runtime/editor/utility/tools.js +32 -0
  97. package/dist/runtime/editor/wysiwyg.d.ts +4 -0
  98. package/dist/runtime/editor/wysiwyg.js +82 -0
  99. package/dist/runtime/utils/frontmatter.d.ts +5 -0
  100. package/dist/runtime/utils/frontmatter.js +26 -0
  101. package/dist/runtime/utils/internalLinks.d.ts +2 -0
  102. package/dist/runtime/utils/internalLinks.js +28 -0
  103. package/dist/runtime/utils/languages/burmese.d.ts +6 -0
  104. package/dist/runtime/utils/languages/burmese.js +1 -0
  105. package/dist/runtime/utils/languages/cjk.d.ts +6 -0
  106. package/dist/runtime/utils/languages/cjk.js +34 -0
  107. package/dist/runtime/utils/languages/index.d.ts +6 -0
  108. package/dist/runtime/utils/languages/index.js +16 -0
  109. package/dist/runtime/utils/languages/javanese.d.ts +6 -0
  110. package/dist/runtime/utils/languages/javanese.js +1 -0
  111. package/dist/runtime/utils/languages/khmer.d.ts +6 -0
  112. package/dist/runtime/utils/languages/khmer.js +1 -0
  113. package/dist/runtime/utils/languages/lao.d.ts +6 -0
  114. package/dist/runtime/utils/languages/lao.js +1 -0
  115. package/dist/runtime/utils/languages/thai.d.ts +6 -0
  116. package/dist/runtime/utils/languages/thai.js +1 -0
  117. package/dist/runtime/utils/languages/vai.d.ts +6 -0
  118. package/dist/runtime/utils/languages/vai.js +1 -0
  119. package/dist/runtime/utils/markdownParser.d.ts +12 -0
  120. package/dist/runtime/utils/markdownParser.js +11 -0
  121. package/package.json +33 -14
  122. package/dist/runtime/assets/css/main.css +0 -1
  123. package/dist/runtime/components/YamlCollapsible.d.vue.ts +0 -47
  124. package/dist/runtime/components/YamlCollapsible.vue +0 -43
  125. package/dist/runtime/components/YamlCollapsible.vue.d.ts +0 -47
  126. package/dist/runtime/components/YamlFieldInput.d.vue.ts +0 -54
  127. package/dist/runtime/components/YamlFieldInput.vue +0 -158
  128. package/dist/runtime/components/YamlFieldInput.vue.d.ts +0 -54
  129. package/dist/runtime/components/YamlFormEditor.d.vue.ts +0 -66
  130. package/dist/runtime/components/YamlFormEditor.vue +0 -70
  131. package/dist/runtime/components/YamlFormEditor.vue.d.ts +0 -66
  132. package/dist/runtime/components/YamlFormField.d.vue.ts +0 -56
  133. package/dist/runtime/components/YamlFormField.vue +0 -492
  134. package/dist/runtime/components/YamlFormField.vue.d.ts +0 -56
  135. package/dist/runtime/composables/useYamlFieldTypes.d.ts +0 -13
  136. package/dist/runtime/composables/useYamlFieldTypes.js +0 -137
  137. package/dist/runtime/composables/useYamlFormData.d.ts +0 -24
  138. package/dist/runtime/composables/useYamlFormData.js +0 -122
  139. package/dist/runtime/types/types.d.ts +0 -30
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "@type32/yaml-editor-form",
3
- "configKey": "yamlEditorForm",
4
- "version": "0.1.9",
2
+ "name": "@type32/codemirror-rich-obsidian-editor",
3
+ "configKey": "cmOfmEditor",
4
+ "version": "0.1.14",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -2,23 +2,26 @@ import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir } fro
2
2
 
3
3
  const module$1 = defineNuxtModule({
4
4
  meta: {
5
- name: "@type32/yaml-editor-form",
6
- configKey: "yamlEditorForm"
5
+ name: "@type32/codemirror-rich-obsidian-editor",
6
+ configKey: "cmOfmEditor"
7
7
  },
8
8
  // Default configuration options of the Nuxt module
9
9
  defaults: {},
10
10
  setup(_options, _nuxt) {
11
11
  const resolver = createResolver(import.meta.url);
12
- addComponentsDir({ path: resolver.resolve("runtime/components") });
12
+ addComponentsDir({
13
+ path: resolver.resolve("runtime/components")
14
+ });
13
15
  addImportsDir(resolver.resolve("runtime/composables"));
14
- _nuxt.options.build.transpile.push("js-yaml");
15
- _nuxt.options.alias["@type32/yaml-editor-form"] = resolver.resolve(
16
- "./runtime/types/types"
16
+ addImportsDir(resolver.resolve("runtime/utils"));
17
+ _nuxt.options.build.transpile.push("alfaaz", "js-yaml");
18
+ _nuxt.options.alias["#codemirror-rich-obsidian-editor"] = resolver.resolve(
19
+ "./runtime/editor/types"
17
20
  );
18
- _nuxt.options.alias["@type32/yaml-editor-form"] = resolver.resolve(
21
+ _nuxt.options.alias["#codemirror-rich-obsidian-editor#css"] = resolver.resolve(
19
22
  "./runtime/assets/css"
20
23
  );
21
- _nuxt.options.css.unshift(resolver.resolve("./runtime/assets/css/main.css"));
24
+ _nuxt.options.css.unshift(resolver.resolve("./runtime/assets/css/editor.css"));
22
25
  }
23
26
  });
24
27
 
@@ -0,0 +1 @@
1
+ @import url("https://fonts.cdnfonts.com/css/segoe-ui-variable-static-display");@import url("https://fonts.cdnfonts.com/css/sf-pro-display");@import "katex/dist/katex.min.css";@import "tailwindcss";@import "@nuxt/ui";@theme{--font-sans:"Public Sans","Inter","SF Pro Display","Segoe UI Variable Static Display",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--font-editor:"Inter","SF Pro Display","Segoe UI Variable Static Display",var(--font-sans,sans-serif);--font-editor-code:"Google Sans Code","JetBrains Mono","Consolas",var(--font-mono,ui-monospace);--list-indent:1.5rem;--indent-level:0}.cm-code-editor{@apply font-editor-code}.cm-code-editor .cm-content,.cm-code-editor .cm-placeholder{@apply font-editor-code text-sm}.cm-code-editor .cm-editor{@apply bg-default}.cm-code-editor .cm-placeholder{@apply text-dimmed}.cm-code-editor .cm-gutters,.cm-code-editor .cm-gutters-before{@apply bg-default text-muted text-sm border-r border-r-accented font-editor-code}.cm-code-editor .cm-activeLineGutter{@apply bg-elevated}.cm-code-editor .cm-activeLine{@apply bg-muted}.cm-code-editor .cm-foldPlaceholder{@apply bg-elevated border border-default font-editor-code text-muted}.cm-rich-editor{@apply font-editor}.cm-rich-editor .cm-activeLine{@apply after:absolute after:left-0 after:border-primary after:border after:rounded-lg after:h-full after:top-0 -z-10 bg-inherit}.cm-rich-editor .cm-content{@apply font-editor}.cm-rich-editor .katex-display{@apply m-0 pointer-events-none}.cm-rich-editor .katex-display .katex,.cm-rich-editor .katex-display .katex-html{@apply pointer-events-none}.cm-rich-editor .cm-escape,.cm-rich-editor .cm-meta{@apply text-dimmed! no-underline!}.cm-rich-editor .cm-heading{text-decoration:none!important}.cm-rich-editor .cm-mono{@apply font-editor-code bg-muted px-1 rounded-lg border border-default text-toned!}.cm-rich-editor .cm-hashtag{@apply bg-gradient-to-t from-primary/20! to-primary/10! ring ring-primary/50! px-1.5 text-sm rounded-4xl text-primary! inline-flex}.cm-rich-editor .cm-hashtag .cm-heading{@apply text-primary!}.cm-rich-editor .cm-highlighted{@apply bg-primary/20 text-primary px-0.5 rounded-sm}.cm-rich-editor .cm-internal-link-display,.cm-rich-editor .cm-internal-link-path,.cm-rich-editor .cm-internal-link-subpath,.cm-rich-editor .cm-link{@apply text-primary! underline}.cm-rich-editor .cm-internal-link-display[data-type=internal-link],.cm-rich-editor .cm-internal-link-path[data-type=internal-link],.cm-rich-editor .cm-internal-link-subpath[data-type=internal-link],.cm-rich-editor .cm-link[data-type=internal-link]{@apply cursor-pointer}.cm-rich-editor .cm-clickable-link{@apply cursor-pointer}.cm-rich-editor .cm-unresolved-link .cm-internal-link-display,.cm-rich-editor .cm-unresolved-link .cm-internal-link-path,.cm-rich-editor .cm-unresolved-link .cm-internal-link-subpath,.cm-rich-editor .cm-unresolved-link .cm-link{@apply text-error/75! cursor-not-allowed}.cm-rich-editor .cm-codeblock,.cm-rich-editor .cm-line-codeblock-begin,.cm-rich-editor .cm-line-codeblock-end{@apply font-editor-code py-0 my-0 text-sm! font-semibold border-x border-x-default mx-2 px-3 bg-muted relative}.cm-rich-editor .cm-codeblock .cm-codeblock-flair-container,.cm-rich-editor .cm-line-codeblock-begin .cm-codeblock-flair-container,.cm-rich-editor .cm-line-codeblock-end .cm-codeblock-flair-container{@apply absolute top-2 right-2 overflow-visible z-10}.cm-rich-editor .cm-codeblock .cm-codeblock-flair-container .cm-codeblock-copy-button,.cm-rich-editor .cm-line-codeblock-begin .cm-codeblock-flair-container .cm-codeblock-copy-button,.cm-rich-editor .cm-line-codeblock-end .cm-codeblock-flair-container .cm-codeblock-copy-button{@apply rounded hover:bg-accented transition duration-200 cursor-pointer py-1.5 px-2 font-sans text-dimmed z-10}.cm-rich-editor .cm-codeblock .cm-mono,.cm-rich-editor .cm-line-codeblock-begin .cm-mono,.cm-rich-editor .cm-line-codeblock-end .cm-mono{@apply border-none bg-none text-default}.cm-rich-editor .cm-line-codeblock-content{@apply border-x border-x-accented}.cm-rich-editor .cm-line-codeblock-begin{@apply rounded-t-lg border-t border-x border-t-accented border-x-accented pt-1 px-1}.cm-rich-editor .cm-line-codeblock-end{@apply rounded-b-lg border-b border-x border-b-accented border-x-accented pb-1 px-1}.cm-rich-editor .cm-task-checkbox-wrapper{@apply size-4 mb-0.5 rounded-xl border border-default bg-default inline-flex items-center justify-center align-middle cursor-pointer}.cm-rich-editor .cm-task-checkbox-wrapper[data-checked=true]{@apply bg-primary border border-primary}.cm-rich-editor .cm-task-checkbox-wrapper[data-checked=true]:before{content:"✔";@apply text-xs text-inverted}.cm-rich-editor .cm-task-checkbox-wrapper[data-special]{@apply font-editor-code text-xs text-highlighted}.cm-rich-editor .cm-task-checked{@apply line-through text-dimmed}.cm-rich-editor .cm-tooltip{@apply rounded-lg bg-default/70 shadow-lg backdrop-blur-sm border border-default font-sans p-2}.cm-rich-editor .cm-tooltip ul{@apply grid grid-cols-1 font-sans}.cm-rich-editor .cm-tooltip ul li{@apply grid grid-cols-1 rounded font-sans gap-1}.cm-rich-editor .cm-tooltip ul li .cm-completionLabel{@apply mx-1 mt-1 text-toned}.cm-rich-editor .cm-tooltip ul li .cm-completionDetail{@apply text-xs font-editor-code bg-elevated w-fit rounded text-muted px-1 mb-1}.cm-rich-editor .cm-tooltip ul li[aria-selected=true]{@apply bg-accented/70 backdrop-blur-sm border border-accented}.cm-rich-editor .cm-fold-widget{@apply absolute -left-0.5 pt-1}.cm-rich-editor .cm-gutter,.cm-rich-editor .cm-gutters{@apply bg-transparent! border-none}.cm-rich-editor .cm-foldPlaceholder{@apply bg-accented! text-dimmed! border border-none ml-0.5 h-fit inline-flex items-center justify-center align-middle}.cm-rich-editor .cm-gutterElement{@apply inline-flex justify-center items-center}.cm-rich-editor .cm-heading-1{@apply text-4xl! text-highlighted scroll-mt-[calc(45px+var(--ui-header-height))]}.cm-rich-editor .cm-heading-2{@apply text-2xl! text-highlighted scroll-mt-[calc(45px+var(--ui-header-height))]}.cm-rich-editor .cm-heading-3{@apply text-xl! text-highlighted scroll-mt-[calc(45px+var(--ui-header-height))]}.cm-rich-editor .cm-heading-4{@apply text-lg! text-highlighted scroll-mt-[calc(45px+var(--ui-header-height))]}.cm-rich-editor .cm-quoteblock,.cm-rich-editor blockquote{@apply bg-muted border-accented ps-2 mx-2 before:ml-0.5 before:rounded-lg before:px-0.5 before:bg-accented before:py-1}.cm-rich-editor .cm-quoteblock.cm-quoteblock-single,.cm-rich-editor blockquote.cm-quoteblock-single{@apply rounded-lg py-2 before:py-0.5}.cm-rich-editor .cm-quoteblock.cm-quoteblock-start,.cm-rich-editor blockquote.cm-quoteblock-start{@apply rounded-t-lg pt-2 before:pt-0}.cm-rich-editor .cm-quoteblock.cm-quoteblock-end,.cm-rich-editor blockquote.cm-quoteblock-end{@apply rounded-b-lg pb-2 before:pb-0}.cm-rich-editor .cm-quoteblock .cm-formatting-quote.cm-meta,.cm-rich-editor blockquote .cm-formatting-quote.cm-meta{@apply invisible}.cm-rich-editor .cm-quoteblock .cm-formatting-quote-active.cm-meta,.cm-rich-editor blockquote .cm-formatting-quote-active.cm-meta{@apply visible!}.cm-rich-editor .cm-obsidian-bullet{@apply text-transparent}.cm-rich-editor .cm-obsidian-bullet .cm-meta{@apply invisible}.cm-rich-editor .cm-obsidian-bullet:before{content:"•";@apply text-dimmed absolute}.cm-rich-editor .callout,.cm-rich-editor .cm-callout-widget{@apply p-3 relative flex flex-col h-fit rounded-xl border border-primary/20 from-primary/10 to-primary/20 bg-gradient-to-b}.cm-rich-editor .callout summary,.cm-rich-editor .cm-callout-widget summary{@apply inline-flex}.cm-rich-editor .callout .callout-title,.cm-rich-editor .cm-callout-widget .callout-title{@apply flex gap-1.5 items-center}.cm-rich-editor .callout .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget .callout-title .callout-title-icon{@apply flex size-4 items-center justify-center fill-primary text-primary}.cm-rich-editor .callout .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget .callout-title .callout-title-inner{@apply text-primary text-lg font-bold flex-grow}.cm-rich-editor .callout .callout-title .edit-block-button,.cm-rich-editor .cm-callout-widget .callout-title .edit-block-button{@apply rounded hover:bg-elevated transition duration-200 cursor-pointer p-1 font-sans right-0 top-0 text-dimmed}.cm-rich-editor .callout .callout-content,.cm-rich-editor .cm-callout-widget .callout-content{@apply flex flex-col gap-1}.cm-rich-editor .callout[data-callout=info],.cm-rich-editor .cm-callout-widget[data-callout=info]{@apply from-info/10 to-info/20 bg-gradient-to-b border-info/20}.cm-rich-editor .callout[data-callout=info] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=info] .callout-fold{@apply text-info-400}.cm-rich-editor .callout[data-callout=info] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=info] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=info] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=info] .callout-title .callout-title-inner{@apply text-info}.cm-rich-editor .callout[data-callout=check],.cm-rich-editor .callout[data-callout=done],.cm-rich-editor .callout[data-callout=success],.cm-rich-editor .cm-callout-widget[data-callout=check],.cm-rich-editor .cm-callout-widget[data-callout=done],.cm-rich-editor .cm-callout-widget[data-callout=success]{@apply from-success/10 to-success/20 bg-gradient-to-b border-success/20}.cm-rich-editor .callout[data-callout=check] .callout-fold,.cm-rich-editor .callout[data-callout=done] .callout-fold,.cm-rich-editor .callout[data-callout=success] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=check] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=done] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=success] .callout-fold{@apply text-success-400}.cm-rich-editor .callout[data-callout=check] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=check] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=done] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=done] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=success] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=success] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=check] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=check] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=done] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=done] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=success] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=success] .callout-title .callout-title-inner{@apply text-success}.cm-rich-editor .callout[data-callout=faq],.cm-rich-editor .callout[data-callout=help],.cm-rich-editor .callout[data-callout=question],.cm-rich-editor .callout[data-callout=warning],.cm-rich-editor .cm-callout-widget[data-callout=faq],.cm-rich-editor .cm-callout-widget[data-callout=help],.cm-rich-editor .cm-callout-widget[data-callout=question],.cm-rich-editor .cm-callout-widget[data-callout=warning]{@apply from-warning/10 to-warning/20 bg-gradient-to-b border-warning/20}.cm-rich-editor .callout[data-callout=faq] .callout-fold,.cm-rich-editor .callout[data-callout=help] .callout-fold,.cm-rich-editor .callout[data-callout=question] .callout-fold,.cm-rich-editor .callout[data-callout=warning] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=faq] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=help] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=question] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=warning] .callout-fold{@apply text-warning-400}.cm-rich-editor .callout[data-callout=faq] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=faq] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=help] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=help] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=question] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=question] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=warning] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=warning] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=faq] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=faq] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=help] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=help] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=question] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=question] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=warning] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=warning] .callout-title .callout-title-inner{@apply text-warning}.cm-rich-editor .callout[data-callout=bug],.cm-rich-editor .callout[data-callout=error],.cm-rich-editor .callout[data-callout=failure],.cm-rich-editor .cm-callout-widget[data-callout=bug],.cm-rich-editor .cm-callout-widget[data-callout=error],.cm-rich-editor .cm-callout-widget[data-callout=failure]{@apply from-error/10 to-error/20 bg-gradient-to-b border-error/20}.cm-rich-editor .callout[data-callout=bug] .callout-fold,.cm-rich-editor .callout[data-callout=error] .callout-fold,.cm-rich-editor .callout[data-callout=failure] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=bug] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=error] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=failure] .callout-fold{@apply text-error-400}.cm-rich-editor .callout[data-callout=bug] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=bug] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=error] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=error] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=failure] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=failure] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=bug] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=bug] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=error] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=error] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=failure] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=failure] .callout-title .callout-title-inner{@apply text-error}.cm-rich-editor .callout[data-callout=example],.cm-rich-editor .callout[data-callout=highlight],.cm-rich-editor .callout[data-callout=tip],.cm-rich-editor .cm-callout-widget[data-callout=example],.cm-rich-editor .cm-callout-widget[data-callout=highlight],.cm-rich-editor .cm-callout-widget[data-callout=tip]{@apply from-secondary/10 to-secondary/20 bg-gradient-to-b border-secondary/20}.cm-rich-editor .callout[data-callout=example] .callout-fold,.cm-rich-editor .callout[data-callout=highlight] .callout-fold,.cm-rich-editor .callout[data-callout=tip] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=example] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=highlight] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=tip] .callout-fold{@apply text-secondary}.cm-rich-editor .callout[data-callout=example] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=example] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=highlight] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=highlight] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=tip] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=tip] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=example] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=example] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=highlight] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=highlight] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=tip] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=tip] .callout-title .callout-title-inner{@apply text-secondary}.cm-rich-editor .callout[data-callout=neutral],.cm-rich-editor .callout[data-callout=quote],.cm-rich-editor .cm-callout-widget[data-callout=neutral],.cm-rich-editor .cm-callout-widget[data-callout=quote]{@apply from-accented/20 to-accented/30 bg-gradient-to-b border-accented/30}.cm-rich-editor .callout[data-callout=neutral] .callout-fold,.cm-rich-editor .callout[data-callout=quote] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=neutral] .callout-fold,.cm-rich-editor .cm-callout-widget[data-callout=quote] .callout-fold{@apply text-highlighted}.cm-rich-editor .callout[data-callout=neutral] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=neutral] .callout-title .callout-title-inner,.cm-rich-editor .callout[data-callout=quote] .callout-title .callout-title-icon,.cm-rich-editor .callout[data-callout=quote] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=neutral] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=neutral] .callout-title .callout-title-inner,.cm-rich-editor .cm-callout-widget[data-callout=quote] .callout-title .callout-title-icon,.cm-rich-editor .cm-callout-widget[data-callout=quote] .callout-title .callout-title-inner{@apply text-highlighted}.cm-rich-editor .callout .callout-fold,.cm-rich-editor .cm-callout-widget .callout-fold{@apply rounded hover:bg-elevated transition duration-200 cursor-pointer text-primary font-sans text-center align-middle p-1 size-6}.cm-rich-editor .callout .callout-fold svg,.cm-rich-editor .cm-callout-widget .callout-fold svg{@apply transition-transform duration-300 ease-in-out w-full h-full}.cm-rich-editor .callout[open] .callout-fold svg,.cm-rich-editor .cm-callout-widget[open] .callout-fold svg{@apply transition-transform duration-300 ease-in-out rotate-90 w-full h-full}.cm-rich-editor .callout[data-fold-state=closed] .callout-content,.cm-rich-editor .cm-callout-widget[data-fold-state=closed] .callout-content{@apply max-h-0 opacity-0 p-0}.cm-rich-editor .callout[data-fold-state=open] .callout-content,.cm-rich-editor .cm-callout-widget[data-fold-state=open] .callout-content{@apply max-h-none opacity-100 py-1 mt-1}.cm-rich-editor .callout .edit-block-button,.cm-rich-editor .cm-callout-widget .edit-block-button{@apply rounded hover:bg-elevated transition duration-200 cursor-pointer p-1 font-sans text-dimmed}.cm-rich-editor .callout .editing-utils-container,.cm-rich-editor .cm-callout-widget .editing-utils-container{@apply top-2 right-2 font-sans text-dimmed absolute flex items-center justify-center gap-1 p-1}.cm-rich-editor details .callout-content{@apply -mt-11}.cm-rich-editor .cm-indent{min-width:var(--list-indent,1.5rem);@apply relative inline-block}.cm-rich-editor .cm-indent:before{@apply content-["\200B"] absolute top-0 bottom-0 w-1;@apply border-r border-r-muted;@apply left-[var(--indentation-guide-source-indent)]}.cm-rich-editor .cm-indent-group .cm-active-indent:before{@apply border-primary}.cm-rich-editor .cm-list-line .cm-indent:before{@apply top-0}.cm-rich-editor .cm-list-internal[style*="--indent-level"]{@apply border-primary;padding-inline-start:calc(var(--indent-level)*var(--list-indent));text-indent:calc(var(--indent-level)*var(--list-indent))}.cm-rich-editor .cm-indent-list-bullet:before{content:"•";@apply text-dimmed border-none absolute;left:1rem}.cm-rich-editor .cm-indent-list-bullet+.cm-obsidian-bullet{@apply hidden}.cm-rich-editor .cm-obsidian-hidden{@apply hidden}.cm-rich-editor .cm-hidden-latex{@apply hidden}.cm-rich-editor .cm-yaml-content,.cm-rich-editor .cm-yaml-marker{@apply font-editor-code text-muted px-1}.cm-rich-editor .cm-line.hr{@apply h-8 flex items-center}.cm-rich-editor .cm-line.hr:after{content:"";@apply block w-full h-px bg-accented}
@@ -0,0 +1,38 @@
1
+ import { EditorView } from '@codemirror/view';
2
+ import type { Extension } from '@codemirror/state';
3
+ import type { SearchOptions } from '#codemirror-rich-obsidian-editor/editor-types';
4
+ type __VLS_Props = {
5
+ class?: string;
6
+ language?: string;
7
+ bracketClosing?: boolean;
8
+ foldGutter?: boolean;
9
+ disabled?: boolean;
10
+ debug?: boolean;
11
+ searchOptions?: SearchOptions;
12
+ /**
13
+ * Custom theme for light mode. Defaults to Catppuccin Latte.
14
+ * Pass a CodeMirror Extension (e.g., from @codemirror/theme-one-dark)
15
+ */
16
+ lightTheme?: Extension;
17
+ /**
18
+ * Custom theme for dark mode. Defaults to Catppuccin Mocha.
19
+ * Pass a CodeMirror Extension (e.g., from @codemirror/theme-one-dark)
20
+ */
21
+ darkTheme?: Extension;
22
+ colorMode?: string;
23
+ };
24
+ type __VLS_ModelProps = {
25
+ modelValue?: string;
26
+ };
27
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
28
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
29
+ view: import("vue").ShallowRef<EditorView | undefined, EditorView | undefined>;
30
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
+ "update:modelValue": (value: string | undefined) => any;
32
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
33
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
34
+ }>, {
35
+ colorMode: string;
36
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
@@ -0,0 +1,207 @@
1
+ <script setup>
2
+ import CodeMirror from "vue-codemirror6";
3
+ import {
4
+ EditorView,
5
+ drawSelection,
6
+ rectangularSelection,
7
+ highlightActiveLine,
8
+ highlightActiveLineGutter,
9
+ lineNumbers,
10
+ highlightSpecialChars,
11
+ dropCursor,
12
+ crosshairCursor,
13
+ keymap
14
+ } from "@codemirror/view";
15
+ import { history, historyKeymap, defaultKeymap } from "@codemirror/commands";
16
+ import {
17
+ defaultHighlightStyle,
18
+ syntaxHighlighting,
19
+ indentOnInput,
20
+ foldGutter,
21
+ syntaxTree,
22
+ bracketMatching,
23
+ foldKeymap
24
+ } from "@codemirror/language";
25
+ import { Compartment, EditorState } from "@codemirror/state";
26
+ import {} from "@codemirror/language";
27
+ import { languages } from "@codemirror/language-data";
28
+ import { ref, shallowRef, onMounted, watch, computed } from "vue";
29
+ import { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap } from "@codemirror/autocomplete";
30
+ import { highlightSelectionMatches, searchKeymap } from "@codemirror/search";
31
+ import { lintKeymap } from "@codemirror/lint";
32
+ import { catppuccinLatte, catppuccinMocha } from "@catppuccin/codemirror";
33
+ const doc = defineModel({ type: String });
34
+ const props = defineProps({
35
+ class: { type: String, required: false },
36
+ language: { type: String, required: false },
37
+ bracketClosing: { type: Boolean, required: false },
38
+ foldGutter: { type: Boolean, required: false },
39
+ disabled: { type: Boolean, required: false },
40
+ debug: { type: Boolean, required: false },
41
+ searchOptions: { type: Object, required: false },
42
+ lightTheme: { type: [Object, Array], required: false },
43
+ darkTheme: { type: [Object, Array], required: false },
44
+ colorMode: { type: String, required: false, default: "dark" }
45
+ });
46
+ const emit = defineEmits([]);
47
+ const extensions = shallowRef([]);
48
+ const view = shallowRef();
49
+ const ast = ref([]);
50
+ const languageCompartment = new Compartment();
51
+ const themeCompartment = new Compartment();
52
+ const isDark = computed(() => props.colorMode === "dark");
53
+ const currentTheme = computed(() => {
54
+ if (isDark.value) {
55
+ return props.darkTheme || catppuccinMocha;
56
+ }
57
+ return props.lightTheme || catppuccinLatte;
58
+ });
59
+ async function loadLanguage(languageName) {
60
+ if (!languageName) return null;
61
+ const lang = languages.find(
62
+ (l) => l.name.toLowerCase() === languageName.toLowerCase() || l.alias.map((a) => a.toLowerCase()).includes(languageName.toLowerCase())
63
+ );
64
+ if (lang) {
65
+ try {
66
+ return await lang.load();
67
+ } catch (e) {
68
+ console.warn(`Failed to load language: ${languageName}`, e);
69
+ return null;
70
+ }
71
+ }
72
+ console.warn(`Language not found: ${languageName}`);
73
+ return null;
74
+ }
75
+ onMounted(async () => {
76
+ const initialLanguage = await loadLanguage(props.language);
77
+ extensions.value = [
78
+ lineNumbers(),
79
+ // A gutter with code folding markers
80
+ foldGutter(),
81
+ // Replace non-printable characters with placeholders
82
+ highlightSpecialChars(),
83
+ // The undo history
84
+ history(),
85
+ // Replace native cursor/selection with our own
86
+ drawSelection(),
87
+ // Show a drop cursor when dragging over the editor
88
+ dropCursor(),
89
+ // Allow multiple cursors/selections
90
+ EditorState.allowMultipleSelections.of(true),
91
+ // Re-indent lines when typing specific input
92
+ indentOnInput(),
93
+ // Theme compartment - switches between light and dark
94
+ themeCompartment.of(currentTheme.value),
95
+ // Highlight matching brackets near cursor
96
+ bracketMatching(),
97
+ // Automatically close brackets
98
+ closeBrackets(),
99
+ // Load the autocompletion system
100
+ autocompletion(),
101
+ // Allow alt-drag to select rectangular regions
102
+ rectangularSelection(),
103
+ // Change the cursor to a crosshair when holding alt
104
+ crosshairCursor(),
105
+ // Style the current line specially
106
+ highlightActiveLine(),
107
+ // Style the gutter for current line specially
108
+ highlightActiveLineGutter(),
109
+ // Highlight text that matches the selected text
110
+ highlightSelectionMatches(),
111
+ // Language support compartment (can be reconfigured)
112
+ languageCompartment.of(initialLanguage || []),
113
+ keymap.of([
114
+ // Closed-brackets aware backspace
115
+ ...closeBracketsKeymap,
116
+ // A large set of basic bindings
117
+ ...defaultKeymap,
118
+ // Search-related keys
119
+ ...searchKeymap,
120
+ // Redo/undo keys
121
+ ...historyKeymap,
122
+ // Code folding bindings
123
+ ...foldKeymap,
124
+ // Autocompletion keys
125
+ ...completionKeymap,
126
+ // Keys related to the linter system
127
+ ...lintKeymap
128
+ ]),
129
+ EditorView.editable.of(!props.disabled)
130
+ ];
131
+ });
132
+ watch(
133
+ () => props.language,
134
+ async (newLanguage) => {
135
+ if (view.value) {
136
+ const languageSupport = await loadLanguage(newLanguage);
137
+ view.value.dispatch({
138
+ effects: languageCompartment.reconfigure(languageSupport || [])
139
+ });
140
+ }
141
+ }
142
+ );
143
+ watch(
144
+ currentTheme,
145
+ (newTheme) => {
146
+ if (view.value) {
147
+ view.value.dispatch({
148
+ effects: themeCompartment.reconfigure(newTheme)
149
+ });
150
+ }
151
+ }
152
+ );
153
+ function handleReady(payload) {
154
+ view.value = payload.view;
155
+ }
156
+ function iterate() {
157
+ ast.value = [];
158
+ try {
159
+ view.value?.state?.tree.iterate({
160
+ from: 0,
161
+ to: view.value.state.doc.length,
162
+ //@ts-ignore
163
+ enter(node) {
164
+ ast.value.push(`Node: ${node.name}, From: ${node.from}, To: ${node.to}, Text: "${view.value?.state.doc.sliceString(node.from, node.to)}"`);
165
+ }
166
+ });
167
+ } catch (e) {
168
+ console.log(e);
169
+ }
170
+ }
171
+ defineExpose({
172
+ view
173
+ });
174
+ </script>
175
+
176
+ <template>
177
+ <div :class="props.class ? props.class : 'w-full h-full overflow-visible'">
178
+ <ClientOnly class="overflow-visible">
179
+ <div class="w-full cm-code-editor overflow-visible">
180
+ <CodeMirror
181
+ v-model="doc"
182
+ placeholder="Your code here..."
183
+ :autofocus="true"
184
+ :indent-with-tab="true"
185
+ :tab-size="4"
186
+ :tab="true"
187
+ :indent-unit="' '"
188
+ :extensions="extensions"
189
+ @ready="handleReady"
190
+ class="w-full h-full cm-code-editor overflow-visible"
191
+ :disabled="props.disabled"
192
+ :readonly="props.disabled"
193
+ />
194
+ </div>
195
+ <template v-if="props.debug">
196
+ <UButton label="Iterate AST" @click="iterate" />
197
+ <div class="grid grid-cols-1 gap-2 py-2 w-full">
198
+ <div v-for="(content, index) in ast" :key="index">{{ content }}</div>
199
+ </div>
200
+ </template>
201
+ </ClientOnly>
202
+ </div>
203
+ </template>
204
+
205
+ <style>
206
+ @reference "../assets/css/editor.css";.cm-cursor{@apply border-l-primary! border-l-[1.8px]! rounded-lg!}.cm-selectionBackground{@apply bg-primary/30! z-[150]}.cm-selectionLayer{@apply z-[150]!;pointer-events:none}div[contenteditable=true]:focus{@apply outline-none border-none h-full shadow-none}.cm-focused{@apply outline-none!}.cm-placeholder{@apply font-editor text-muted}.cm-activeLine{@apply bg-none! border-l-primary border-l-4 relative -left-1 content-[""] mask-no-clip overflow-visible}
207
+ </style>
@@ -0,0 +1,38 @@
1
+ import { EditorView } from '@codemirror/view';
2
+ import type { Extension } from '@codemirror/state';
3
+ import type { SearchOptions } from '#codemirror-rich-obsidian-editor/editor-types';
4
+ type __VLS_Props = {
5
+ class?: string;
6
+ language?: string;
7
+ bracketClosing?: boolean;
8
+ foldGutter?: boolean;
9
+ disabled?: boolean;
10
+ debug?: boolean;
11
+ searchOptions?: SearchOptions;
12
+ /**
13
+ * Custom theme for light mode. Defaults to Catppuccin Latte.
14
+ * Pass a CodeMirror Extension (e.g., from @codemirror/theme-one-dark)
15
+ */
16
+ lightTheme?: Extension;
17
+ /**
18
+ * Custom theme for dark mode. Defaults to Catppuccin Mocha.
19
+ * Pass a CodeMirror Extension (e.g., from @codemirror/theme-one-dark)
20
+ */
21
+ darkTheme?: Extension;
22
+ colorMode?: string;
23
+ };
24
+ type __VLS_ModelProps = {
25
+ modelValue?: string;
26
+ };
27
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
28
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
29
+ view: import("vue").ShallowRef<EditorView | undefined, EditorView | undefined>;
30
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
+ "update:modelValue": (value: string | undefined) => any;
32
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
33
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
34
+ }>, {
35
+ colorMode: string;
36
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ filePath: string;
3
+ display?: string;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,14 @@
1
+ <script setup>
2
+ defineProps({
3
+ filePath: { type: String, required: true },
4
+ display: { type: String, required: false }
5
+ });
6
+ console.log("upda");
7
+ </script>
8
+
9
+ <template>
10
+ <div class="p-3 grid grid-cols-1">
11
+ <img :src="filePath" class="h-auto min-h-12 max-h-96 object-contain rounded-lg" :alt="display"/>
12
+ <div class="text-muted text-left text-xs select-none mt-1.5 text-pretty">{{ display }}</div>
13
+ </div>
14
+ </template>
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ filePath: string;
3
+ display?: string;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ codeContent?: string;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,17 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ codeContent: { type: String, required: false }
4
+ });
5
+ const clicks = useState(() => 0);
6
+ console.log("update");
7
+ </script>
8
+
9
+ <template>
10
+ <div class="m-3 p-3 border border-default rounded">
11
+ <div>This is a test codeblock.</div>
12
+ <div>{{props?.codeContent}}</div>
13
+ <UButton :label="`You could also add buttons in here: ${clicks}`" @click="() => {
14
+ clicks += 1;
15
+ }"/>
16
+ </div>
17
+ </template>
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ codeContent?: string;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,29 @@
1
+ import { EditorView } from '@codemirror/view';
2
+ import type { InternalLink, SpecialCodeBlockMapping, InternalLinkClickDetail, ExternalLinkClickDetail, SearchOptions } from '#codemirror-rich-obsidian-editor/editor-types';
3
+ type __VLS_Props = {
4
+ class?: string;
5
+ internalLinkMap?: InternalLink[];
6
+ specialCodeBlockMap?: SpecialCodeBlockMapping[];
7
+ bracketClosing?: boolean;
8
+ foldGutter?: boolean;
9
+ disabled?: boolean;
10
+ debug?: boolean;
11
+ searchOptions?: SearchOptions;
12
+ };
13
+ type __VLS_ModelProps = {
14
+ modelValue?: string;
15
+ };
16
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
17
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
18
+ view: import("vue").ShallowRef<EditorView | undefined, EditorView | undefined>;
19
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "update:modelValue": (value: string | undefined) => any;
21
+ "internal-link-click": (detail: InternalLinkClickDetail) => any;
22
+ "external-link-click": (detail: ExternalLinkClickDetail) => any;
23
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
24
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
25
+ "onInternal-link-click"?: ((detail: InternalLinkClickDetail) => any) | undefined;
26
+ "onExternal-link-click"?: ((detail: ExternalLinkClickDetail) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;