markdown-wysiwyg-editor 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -88,6 +88,8 @@ function App() {
88
88
  | `enableCodeBlock` | `boolean` | `true` | Enable code blocks |
89
89
  | `enableLink` | `boolean` | `true` | Enable links |
90
90
  | `mermaidLib` | `typeof mermaid` | - | Mermaid instance (required if `enableMermaid=true`) |
91
+ | `texts` | `Partial<ITexts>` | `DEFAULT_TEXTS` | i18n text labels (see i18n section) |
92
+ | `debug` | `boolean` | `false` | Show debug info (syntax status, paste debug) |
91
93
  | `className` | `string` | - | Additional CSS class |
92
94
  | `style` | `React.CSSProperties` | - | Inline styles |
93
95
  | `onBlur` | `() => void` | - | Blur event handler |
@@ -130,6 +132,83 @@ Consider your app's performance and whether you really need Mermaid.
130
132
 
131
133
  ### Advanced Usage
132
134
 
135
+ #### Internationalization (i18n)
136
+
137
+ This editor supports integration with external i18n systems like **react-i18next** or **next-intl**.
138
+
139
+ ##### Using Translation Keys with react-i18next
140
+
141
+ ```tsx
142
+ import { MarkdownEditor, I18N_KEYS } from '@markdown-wysiwyg/editor';
143
+ import { useTranslation } from 'react-i18next';
144
+
145
+ function App() {
146
+ const { t } = useTranslation();
147
+ const [content, setContent] = useState('');
148
+
149
+ const texts = {
150
+ table: {
151
+ rowOperations: t(I18N_KEYS.table.rowOperations),
152
+ addRowAbove: t(I18N_KEYS.table.addRowAbove),
153
+ addRowBelow: t(I18N_KEYS.table.addRowBelow),
154
+ deleteRow: t(I18N_KEYS.table.deleteRow),
155
+ columnOperations: t(I18N_KEYS.table.columnOperations),
156
+ addColumnLeft: t(I18N_KEYS.table.addColumnLeft),
157
+ addColumnRight: t(I18N_KEYS.table.addColumnRight),
158
+ deleteColumn: t(I18N_KEYS.table.deleteColumn),
159
+ deleteTable: t(I18N_KEYS.table.deleteTable),
160
+ cancel: t(I18N_KEYS.table.cancel),
161
+ },
162
+ };
163
+
164
+ return <MarkdownEditor value={content} onChange={setContent} texts={texts} />;
165
+ }
166
+ ```
167
+
168
+ ##### Add to your i18n JSON files
169
+
170
+ **en.json:**
171
+ ```json
172
+ {
173
+ "markdown_editor": {
174
+ "table": {
175
+ "row_operations": "Row Operations",
176
+ "add_row_above": "Add Row Above",
177
+ "add_row_below": "Add Row Below",
178
+ "delete_row": "Delete Row",
179
+ "column_operations": "Column Operations",
180
+ "add_column_left": "Add Column Left",
181
+ "add_column_right": "Add Column Right",
182
+ "delete_column": "Delete Column",
183
+ "delete_table": "Delete Entire Table",
184
+ "cancel": "Cancel"
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
190
+ **ja.json:**
191
+ ```json
192
+ {
193
+ "markdown_editor": {
194
+ "table": {
195
+ "row_operations": "行の操作",
196
+ "add_row_above": "上に行を追加",
197
+ "add_row_below": "下に行を追加",
198
+ "delete_row": "行を削除",
199
+ "column_operations": "列の操作",
200
+ "add_column_left": "左に列を追加",
201
+ "add_column_right": "右に列を追加",
202
+ "delete_column": "列を削除",
203
+ "delete_table": "テーブル全体を削除",
204
+ "cancel": "キャンセル"
205
+ }
206
+ }
207
+ }
208
+ ```
209
+
210
+ See [docs/i18n.md](./docs/i18n.md) for more details.
211
+
133
212
  #### Custom Toolbar
134
213
 
135
214
  You can hide the built-in toolbar and provide your own UI:
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAsChE,OAAO,8BAA8B,CAAC;AAItC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAatD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAguBzD,CAAC"}
1
+ {"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AA0ChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAatD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0vBzD,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { Editor } from '@tiptap/react';
3
+ import { ITexts } from '../types/index';
3
4
  interface MarkdownToolbarProps {
4
5
  onInsertMarkdown: (markdown: string, cursorOffset?: number) => void;
5
6
  onShowHelp: () => void;
@@ -9,6 +10,7 @@ interface MarkdownToolbarProps {
9
10
  editor?: Editor | null;
10
11
  showDownloadButton?: boolean;
11
12
  onDownloadAsMarkdown?: () => void;
13
+ texts?: Partial<ITexts>;
12
14
  }
13
15
  export declare const MarkdownToolbar: React.FC<MarkdownToolbarProps>;
14
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownToolbar.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownToolbar.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAqBvC,UAAU,oBAAoB;IAC5B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,qBAAqB,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqhB1D,CAAC"}
1
+ {"version":3,"file":"MarkdownToolbar.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownToolbar.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAiBvC,OAAO,EAAiB,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAKvD,UAAU,oBAAoB;IAC5B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,qBAAqB,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkjB1D,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ import { ITexts } from '../types/index';
2
3
  export interface ITableContextMenuProps {
3
4
  isVisible: boolean;
4
5
  position: {
@@ -13,6 +14,7 @@ export interface ITableContextMenuProps {
13
14
  onDeleteRow: () => void;
14
15
  onDeleteColumn: () => void;
15
16
  onDeleteTable: () => void;
17
+ texts?: Partial<ITexts>;
16
18
  }
17
19
  export declare const TableContextMenu: React.FC<ITableContextMenuProps>;
18
20
  //# sourceMappingURL=TableContextMenu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableContextMenu.d.ts","sourceRoot":"","sources":["../../src/components/TableContextMenu.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4H7D,CAAC"}
1
+ {"version":3,"file":"TableContextMenu.d.ts","sourceRoot":"","sources":["../../src/components/TableContextMenu.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAiB,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA6H7D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableEdgeControls.d.ts","sourceRoot":"","sources":["../../src/components/TableEdgeControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,yBAAyB,CAAC;AAGjC,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA8G/D,CAAC"}
1
+ {"version":3,"file":"TableEdgeControls.d.ts","sourceRoot":"","sources":["../../src/components/TableEdgeControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,yBAAyB,CAAC;AAGjC,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA2G/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableToolbar.d.ts","sourceRoot":"","sources":["../../src/components/TableToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,yBAAyB,CAAC;AAOjC,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAyTrD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"TableToolbar.d.ts","sourceRoot":"","sources":["../../src/components/TableToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,yBAAyB,CAAC;AAOjC,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAiMrD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -40,6 +40,10 @@ export declare class JsonToMarkdownConverter {
40
40
  * コードブロックの処理
41
41
  */
42
42
  private static processCodeBlock;
43
+ /**
44
+ * 画像の処理
45
+ */
46
+ private static processImage;
43
47
  /**
44
48
  * テーブルの処理
45
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"JsonToMarkdownConverter.d.ts","sourceRoot":"","sources":["../../src/converters/JsonToMarkdownConverter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,qBAAa,uBAAuB;IAClC;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM;IAQnD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAI3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAoD1B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gB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AAO,CAAC,MAAM,CAAC,eAAe;IAW9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAShC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAM/B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAM3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAsB3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAa9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAI/B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IA+B1B;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,GAAE,MAAsB,GAAG,IAAI;CA4BrF;AAED,eAAe,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlockNodeView.d.ts","sourceRoot":"","sources":["../../src/extensions/CodeBlockNodeView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAkF7C,eAAO,MAAM,iBAAiB,GAAI,0DAA0D,aAAa,4CAWxG,CAAC"}
1
+ {"version":3,"file":"CodeBlockNodeView.d.ts","sourceRoot":"","sources":["../../src/extensions/CodeBlockNodeView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAuE7C,eAAO,MAAM,iBAAiB,GAAI,0DAA0D,aAAa,4CAaxG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCodeBlock.d.ts","sourceRoot":"","sources":["../../src/extensions/CustomCodeBlock.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,4GAI1B,CAAC"}
1
+ {"version":3,"file":"CustomCodeBlock.d.ts","sourceRoot":"","sources":["../../src/extensions/CustomCodeBlock.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,4GAc1B,CAAC"}
@@ -2,5 +2,5 @@ import { Extension } from '@tiptap/core';
2
2
  export declare const createMarkdownPasteExtension: (setIsProcessing: (processing: boolean) => void, setProcessingProgress: (progress: {
3
3
  processed: number;
4
4
  total: number;
5
- }) => void) => Extension<any, any>;
5
+ }) => void, onPasteComplete?: () => void) => Extension<any, any>;
6
6
  //# sourceMappingURL=MarkdownPasteExtension.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownPasteExtension.d.ts","sourceRoot":"","sources":["../../src/extensions/MarkdownPasteExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAUzC,eAAO,MAAM,4BAA4B,GACvC,iBAAiB,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,EAC9C,uBAAuB,CAAC,QAAQ,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,wBAkFhF,CAAC"}
1
+ {"version":3,"file":"MarkdownPasteExtension.d.ts","sourceRoot":"","sources":["../../src/extensions/MarkdownPasteExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAUzC,eAAO,MAAM,4BAA4B,GACvC,iBAAiB,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,EAC9C,uBAAuB,CAAC,QAAQ,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,EAC/E,kBAAkB,MAAM,IAAI,wBAyF7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownShortcutsExtension.d.ts","sourceRoot":"","sources":["../../src/extensions/MarkdownShortcutsExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,eAAO,MAAM,gCAAgC,2BAO3C,CAAC"}
1
+ {"version":3,"file":"MarkdownShortcutsExtension.d.ts","sourceRoot":"","sources":["../../src/extensions/MarkdownShortcutsExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,cAAc,CAAC;AAGjE,eAAO,MAAM,gCAAgC,2BAuD3C,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { ISelectionInfo } from '../utils/selectionUtils';
2
+ interface UseMarkdownEditorProps {
3
+ value?: string;
4
+ initialContent?: string;
5
+ editable: boolean;
6
+ placeholder: string;
7
+ onContentChange?: (content: any) => void;
8
+ onChange?: (markdown: string) => void;
9
+ onMarkdownChange?: (markdown: string) => void;
10
+ onSelectionChange?: (selection: ISelectionInfo) => void;
11
+ onEditorReady?: (editor: any) => void;
12
+ isUpdating: boolean;
13
+ isProcessing: boolean;
14
+ setIsProcessing: (isProcessing: boolean) => void;
15
+ setProcessingProgress: (progress: {
16
+ processed: number;
17
+ total: number;
18
+ }) => void;
19
+ setSelectionInfo: (info: ISelectionInfo | null) => void;
20
+ setContent: (content: any) => void;
21
+ handleLinkContextMenu: (event: React.MouseEvent, linkData: {
22
+ href: string;
23
+ text: string;
24
+ }) => void;
25
+ handleTableContextMenu: (event: React.MouseEvent) => void;
26
+ }
27
+ export declare const useMarkdownEditor: ({ value, initialContent, editable, placeholder, onContentChange, onChange, onMarkdownChange, onSelectionChange, onEditorReady, isUpdating, isProcessing, setIsProcessing, setProcessingProgress, setSelectionInfo, setContent, handleLinkContextMenu, handleTableContextMenu, }: UseMarkdownEditorProps) => import('@tiptap/core').Editor;
28
+ export {};
29
+ //# sourceMappingURL=useMarkdownEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarkdownEditor.d.ts","sourceRoot":"","sources":["../../src/hooks/useMarkdownEditor.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAkB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAMzE,UAAU,sBAAsB;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,IAAI,CAAC;IACxD,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,qBAAqB,EAAE,CAAC,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAChF,gBAAgB,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,UAAU,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,qBAAqB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnG,sBAAsB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC7D;AAED,eAAO,MAAM,iBAAiB,GAAI,iRAkB/B,sBAAsB,kCA4IxB,CAAC"}
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .mw-editor{border:1px solid #d1d5db;border-radius:.375rem;box-shadow:0 1px 2px #0000000d;display:flex;flex-direction:column;position:relative}.mw-editor-scrollable{height:100%}.mw-editor-auto-height{min-height:fit-content}.mw-editor-loading{display:flex;align-items:center;justify-content:center;height:16rem;background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:.375rem}.mw-editor-loading-text{color:#6b7280}.mw-processing-indicator{position:absolute;top:.5rem;right:.5rem;z-index:50}.mw-processing-card{background-color:#fff;border:1px solid #e5e7eb;border-radius:.5rem;box-shadow:0 10px 15px -3px #0000001a;padding:.75rem;display:flex;align-items:center;gap:.5rem;min-width:12rem}.mw-processing-spinner{animation:spin 1s linear infinite;border-radius:9999px;height:1rem;width:1rem;border-bottom:2px solid #3b82f6}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.mw-processing-text{font-size:.75rem}.mw-processing-title{font-weight:500;color:#374151}.mw-processing-status{color:#6b7280}.mw-processing-progress-bar{width:100%;background-color:#e5e7eb;border-radius:9999px;height:.25rem;margin-top:.25rem}.mw-processing-progress-fill{background-color:#3b82f6;height:.25rem;border-radius:9999px;transition:all .3s}.ProseMirror{font-family:Meiryo,メイリオ,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important;line-height:1.625!important;font-size:1rem!important;min-height:100%!important;width:100%!important;cursor:text;outline:none;padding:1rem}.mw-editor-auto-height .ProseMirror{min-height:auto!important}.ProseMirror h1{font-size:1.5rem;font-weight:600;color:#111827;border-bottom:1px solid #e5e7eb;padding-bottom:.5rem;margin-top:1.5rem;margin-bottom:1rem}.ProseMirror h2{font-size:1.25rem;font-weight:600;color:#111827;border-bottom:1px solid #f3f4f6;padding-bottom:.25rem;margin-top:1.25rem;margin-bottom:.75rem}.ProseMirror h3{font-size:1.125rem;font-weight:600;color:#111827;margin-top:1rem;margin-bottom:.5rem}.ProseMirror p{color:#374151;line-height:1.625;margin-bottom:.75rem}.ProseMirror strong{color:#111827;font-weight:600}.ProseMirror em{color:#1f2937}.ProseMirror code{background-color:#e5e7eb!important;color:#111827!important;padding:.125rem .375rem!important;border-radius:.25rem!important;border:1px solid rgb(209 213 219)!important;font-family:ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace!important;font-size:.875rem}.ProseMirror ul{list-style-type:none!important;padding-left:0!important;margin:.75rem 0}.ProseMirror ol{list-style-type:decimal;padding-left:1.5rem;margin:.75rem 0}.ProseMirror li{position:relative!important;padding-left:1.5rem!important;color:#374151;margin-bottom:.25rem}.ProseMirror ul li:before{content:"•"!important;position:absolute!important;left:0!important;color:#6b7280!important}.ProseMirror blockquote{border-left:4px solid rgb(209 213 219)!important;padding-left:1rem!important;padding-top:.75rem!important;padding-bottom:.75rem!important;background-color:#f9fafb!important;border-top-right-radius:.375rem!important;border-bottom-right-radius:.375rem!important;margin:.75rem 0!important;color:#4b5563;font-style:italic}.ProseMirror a{color:#2563eb;text-decoration:underline;word-break:break-words}.ProseMirror a:hover{color:#1e40af}.ProseMirror hr{border:none;border-top:1px solid #d1d5db;margin:1.5rem 0}.ProseMirror img{max-width:100%;height:auto;border-radius:.5rem;box-shadow:0 1px 3px #0000001a;border:1px solid #e5e7eb;margin:.5rem 0}.ProseMirror table{border-collapse:collapse;width:100%;margin:1rem 0}.ProseMirror th{border:1px solid #d1d5db;background-color:#f9fafb;padding:.75rem;text-align:left;font-weight:600;color:#111827}.ProseMirror td{border:1px solid #d1d5db;padding:.75rem;color:#374151}.tiptap-table-enhanced .tableWrapper{position:relative!important;overflow-x:auto}.table-cell-hover{background-color:#3b82f60d!important}.markdown-editor-content{flex:1;overflow-y:auto;position:relative}.markdown-editor-content-auto-height{min-height:fit-content;overflow:visible}.markdown-editor-content-scrollable{height:100%;overflow-y:auto}.flex{display:flex}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.space-x-2>*+*{margin-left:.5rem}.relative{position:relative}.absolute{position:absolute}.border{border-width:1px}.border-gray-200{border-color:#e5e7eb}.border-gray-300{border-color:#d1d5db}.rounded-md{border-radius:.375rem}.rounded-lg{border-radius:.5rem}.shadow-sm{box-shadow:0 1px 2px #0000000d}.shadow-lg{box-shadow:0 10px 15px -3px #0000001a}.bg-white{background-color:#fff}.bg-gray-50{background-color:#f9fafb}.bg-gray-200{background-color:#e5e7eb}.bg-blue-500{background-color:#3b82f6}.text-gray-500{color:#6b7280}.text-gray-700{color:#374151}.text-xs{font-size:.75rem}.font-medium{font-weight:500}.p-3{padding:.75rem}.top-2{top:.5rem}.right-2{right:.5rem}.z-50{z-index:50}.h-4{height:1rem}.w-4{width:1rem}.h-1{height:.25rem}.w-full{width:100%}.min-w-48{min-width:12rem}.mt-1{margin-top:.25rem}.h-full{height:100%}.min-h-fit{min-height:fit-content}.h-64{height:16rem}.animate-spin{animation:spin 1s linear infinite}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.rounded-full{border-radius:9999px}.border-b-2{border-bottom-width:2px}.ProseMirror{font-family:Meiryo,メイリオ,sans-serif!important;line-height:1.625!important;font-size:1rem!important;min-height:100%!important;width:100%!important;cursor:text}.markdown-editor-content.markdown-editor-autoheight .ProseMirror{min-height:auto!important}.markdown-editor-content .ProseMirror,.ProseMirror p,.ProseMirror li,.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6,.ProseMirror blockquote{cursor:text}.ProseMirror:empty:before{content:attr(data-placeholder);float:left;color:#aaa;pointer-events:none;height:0}.ProseMirror pre{background-color:#334155!important;color:#e5e7eb!important;border:1px solid rgb(100 116 139)!important;border-radius:.5rem!important;padding:1rem!important;margin:.75rem 0!important;overflow-x:auto!important;max-width:80ch!important;width:100%!important;white-space:pre!important}.ProseMirror pre code{background-color:transparent!important;color:#e5e7eb!important;padding:0!important;border:none!important;font-family:ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace!important;font-size:.875rem!important;line-height:1.625!important;white-space:pre!important;display:block!important}.ProseMirror ul{list-style-type:none!important;padding-left:0!important}.ProseMirror li{position:relative!important;padding-left:1.5rem!important}.ProseMirror li:before{content:""!important;position:absolute!important;left:0!important;color:#6b7280!important}.ProseMirror blockquote{border-left:4px solid rgb(209 213 219)!important;padding-left:1rem!important;padding-top:.75rem!important;padding-bottom:.75rem!important;background-color:#f9fafb!important;border-top-right-radius:.375rem!important;border-bottom-right-radius:.375rem!important;margin:.75rem 0!important}.ProseMirror code{background-color:#e5e7eb!important;color:#111827!important;padding:.125rem .375rem!important;border-radius:.25rem!important;border:1px solid rgb(209 213 219)!important;font-family:ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace!important}.tiptap-table-enhanced .tableWrapper{position:relative!important}.tiptap-table-enhanced .resize-cursor{cursor:col-resize!important;border-right:2px solid #3b82f6!important;background:#3b82f61a!important}.tiptap-table-enhanced th:hover,.tiptap-table-enhanced td:hover{background-color:#3b82f60d!important;transition:background-color .2s ease!important}.tiptap-table-enhanced table{border-collapse:separate!important;border-spacing:0!important;max-width:800px!important;width:auto!important}
1
+ @tailwind base;@tailwind components;@tailwind utilities;.ProseMirror .blockquote-custom{@apply border-l-4 border-gray-300 pl-4 italic text-gray-600 bg-gray-50 py-3 rounded-r-md my-4;}.ProseMirror .blockquote-custom p{@apply m-0;}.ProseMirror ul li::marker,.ProseMirror ol li::marker{color:#000;font-weight:600}.ProseMirror code:not(pre code){background-color:#fef2f2!important;color:#b91c1c!important;padding:2px 6px!important;border-radius:3px!important;font-size:.9em!important;border:1px solid #fecaca!important;font-family:Monaco,Menlo,Ubuntu Mono,monospace!important;font-weight:400!important}.ProseMirror table{border-collapse:collapse!important}.ProseMirror table th,.ProseMirror table td{border:2px solid #9ca3af!important}.ProseMirror table th{background-color:#f9fafb!important}.ProseMirror pre{overflow:visible!important;background:#1e293b!important;color:#e2e8f0!important}.ProseMirror pre code{overflow-x:auto;display:block;white-space:pre;color:#e2e8f0!important;background:transparent!important;border:none!important;padding:0!important}.ProseMirror .hljs{background:#1e293b!important;color:#e2e8f0!important}.mw-toolbar-root [data-tooltip]{position:relative}.mw-toolbar-root [data-tooltip]:before{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);padding:6px 8px;background-color:#1f2937;color:#fff;font-size:12px;white-space:nowrap;border-radius:4px;opacity:0;pointer-events:none;transition:opacity .1s ease-in-out;z-index:1000}.mw-toolbar-root [data-tooltip]:after{content:"";position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);border:6px solid transparent;border-bottom-color:#1f2937;opacity:0;pointer-events:none;transition:opacity .1s ease-in-out;z-index:1000}.mw-toolbar-root [data-tooltip]:hover:before,.mw-toolbar-root [data-tooltip]:hover:after{opacity:1}
package/dist/index.d.ts CHANGED
@@ -15,5 +15,6 @@ export { TableResizeEnhancement } from './extensions/TableResizeEnhancement';
15
15
  export { useTableToolbar } from './hooks/useTableToolbar';
16
16
  export { createLogger, createContextLogger } from './utils/logger';
17
17
  export { SelectionUtils } from './utils/selectionUtils';
18
- export type { IMarkdownEditorProps, ILanguageOption, ISelectionInfo, } from './types/index';
18
+ export type { IMarkdownEditorProps, ILanguageOption, ISelectionInfo, ITexts, } from './types/index';
19
+ export { DEFAULT_TEXTS, I18N_KEYS } from './types/index';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAA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