mino-daisy-react 1.1.6 → 1.1.8

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/index.js CHANGED
@@ -21997,6 +21997,9 @@ class ImageNode extends DecoratorNode {
21997
21997
  function $createImageNode({ src, alt, width, height, key }) {
21998
21998
  return $applyNodeReplacement(new ImageNode(src, alt, width, height, key));
21999
21999
  }
22000
+ function $isImageNode(node) {
22001
+ return node instanceof ImageNode;
22002
+ }
22000
22003
 
22001
22004
  // node_modules/.pnpm/@lexical+code@0.38.2/node_modules/@lexical/code/LexicalCode.dev.mjs
22002
22005
  var import_prismjs = __toESM(require_prism(), 1);
@@ -25133,7 +25136,26 @@ function MarkdownShortcutPlugin({
25133
25136
  import { useEffect as useEffect12, useRef as useRef4 } from "react";
25134
25137
 
25135
25138
  // src/rich-text-editor/markdown-transformers.ts
25139
+ var IMAGE = {
25140
+ dependencies: [ImageNode],
25141
+ export: (node) => {
25142
+ if (!$isImageNode(node)) {
25143
+ return null;
25144
+ }
25145
+ return `![${node.getAlt() || ""}](${node.getSrc()})`;
25146
+ },
25147
+ importRegExp: /!(?:\[([^\]]*)\])(?:\(([^)]+)\))/,
25148
+ regExp: /!(?:\[([^\]]*)\])(?:\(([^)]+)\))$/,
25149
+ replace: (textNode, match2) => {
25150
+ const [, alt, src] = match2;
25151
+ const imageNode = $createImageNode({ src, alt: alt || "" });
25152
+ textNode.replace(imageNode);
25153
+ },
25154
+ trigger: ")",
25155
+ type: "text-match"
25156
+ };
25136
25157
  var MARKDOWN_TRANSFORMERS = [
25158
+ IMAGE,
25137
25159
  HEADING,
25138
25160
  QUOTE,
25139
25161
  BOLD_STAR,
@@ -1,3 +1,8 @@
1
+ import { type TextMatchTransformer } from '@lexical/markdown';
2
+ /**
3
+ * Image transformer for markdown format: ![alt](src)
4
+ */
5
+ export declare const IMAGE: TextMatchTransformer;
1
6
  /**
2
7
  * Markdown transformers matching RichTextEditor's supported nodes.
3
8
  *
@@ -15,15 +20,11 @@
15
20
  * - Strikethrough: ~~strikethrough~~
16
21
  * - Inline code: `code`
17
22
  * - Links: [text](url)
23
+ * - Images: ![alt](src)
18
24
  * - Unordered lists: - item or * item
19
25
  * - Ordered lists: 1. item
20
26
  */
21
- export declare const MARKDOWN_TRANSFORMERS: (import("@lexical/markdown").ElementTransformer | Readonly<{
22
- format: ReadonlyArray<import("lexical").TextFormatType>;
23
- tag: string;
24
- intraword?: boolean;
25
- type: "text-format";
26
- }> | Readonly<{
27
+ export declare const MARKDOWN_TRANSFORMERS: (Readonly<{
27
28
  dependencies: Array<import("lexical").Klass<import("lexical").LexicalNode>>;
28
29
  export?: (node: import("lexical").LexicalNode, exportChildren: (node: import("lexical").ElementNode) => string, exportFormat: (node: import("lexical").TextNode, textContent: string) => string) => string | null;
29
30
  importRegExp?: RegExp;
@@ -32,5 +33,10 @@ export declare const MARKDOWN_TRANSFORMERS: (import("@lexical/markdown").Element
32
33
  getEndIndex?: (node: import("lexical").TextNode, match: RegExpMatchArray) => number | false;
33
34
  trigger?: string;
34
35
  type: "text-match";
36
+ }> | import("@lexical/markdown").ElementTransformer | Readonly<{
37
+ format: ReadonlyArray<import("lexical").TextFormatType>;
38
+ tag: string;
39
+ intraword?: boolean;
40
+ type: "text-format";
35
41
  }>)[];
36
42
  //# sourceMappingURL=markdown-transformers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-transformers.d.ts","sourceRoot":"","sources":["../../src/rich-text-editor/markdown-transformers.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;KAcjC,CAAA"}
1
+ {"version":3,"file":"markdown-transformers.d.ts","sourceRoot":"","sources":["../../src/rich-text-editor/markdown-transformers.ts"],"names":[],"mappings":"AAAA,OAAO,EAcL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAA;AAG1B;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,oBAiBnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;KAejC,CAAA"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/giacomorebonato/mino-daisy-react.git"
6
6
  },
7
- "version": "1.1.6",
7
+ "version": "1.1.8",
8
8
  "description": "React component library wrapping DaisyUI components",
9
9
  "type": "module",
10
10
  "main": "./dist/index.js",