rme 0.2.1 → 0.2.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/dist/index.d.ts CHANGED
@@ -1,23 +1,26 @@
1
1
  import * as _drl990114_codemirror_themes from '@drl990114/codemirror-themes';
2
2
  import { CreateThemeOptions } from '@drl990114/codemirror-themes';
3
3
  export { CreateThemeOptions, createTheme } from '@drl990114/codemirror-themes';
4
+ import { LanguageSupport, LanguageDescription } from '@codemirror/language';
4
5
  import { Compartment, Extension } from '@codemirror/state';
5
6
  import { EditorView, EditorViewConfig } from '@codemirror/view';
6
7
  import { ProsemirrorNode, EditorView as EditorView$1 } from '@remirror/pm';
7
- import { LanguageSupport, LanguageDescription } from '@codemirror/language';
8
8
  import * as react from 'react';
9
9
  import react__default, { ReactNode, MouseEvent, FC } from 'react';
10
10
  import { RemirrorEventListenerProps, Extension as Extension$1, RemirrorManager as RemirrorManager$1, AnyExtension as AnyExtension$1 } from 'remirror';
11
11
  import { AnyExtension, RemirrorManager, CommandDecoratorMessageProps, CoreIcon } from '@remirror/core';
12
12
  import { ReactFrameworkOutput } from '@remirror/react-core';
13
13
  import { Node, Schema, Mark, NodeType } from '@remirror/pm/model';
14
- import { Token } from 'markdown-it';
14
+ import { Token as Token$1 } from 'markdown-it/index.js';
15
+ import Token from 'markdown-it/lib/token.mjs';
15
16
  export { useCommands, useHelpers, useKeymap, useRemirrorContext } from '@remirror/react';
16
17
  import * as styled_components from 'styled-components';
17
18
  import * as styled_components_dist_types from 'styled-components/dist/types';
18
19
 
19
20
  type LoadLanguage = (lang: string) => Promise<LanguageSupport> | LanguageSupport | void;
20
21
 
22
+ type CustomCopyFunction = (code: string) => Promise<boolean> | boolean;
23
+
21
24
  declare const changeTheme: (theme: CreateThemeOptions) => void;
22
25
  declare const extractMatches: (view: EditorView) => any[];
23
26
  type CreateCodemirrorOptions = {
@@ -27,6 +30,20 @@ type CreateCodemirrorOptions = {
27
30
  useProsemirrorHistoryKey?: boolean;
28
31
  codemirrorEditorViewConfig?: EditorViewConfig;
29
32
  onValueChange?: (value: string) => void;
33
+ /**
34
+ * Copy button configuration options
35
+ */
36
+ copyButton?: {
37
+ /**
38
+ * Whether to show the copy button
39
+ * @default true
40
+ */
41
+ enabled?: boolean;
42
+ /**
43
+ * Custom copy function to override default behavior
44
+ */
45
+ customCopyFunction?: CustomCopyFunction;
46
+ };
30
47
  };
31
48
  declare class MfCodemirrorView {
32
49
  private readonly view;
@@ -43,6 +60,8 @@ declare class MfCodemirrorView {
43
60
  updating: boolean;
44
61
  loadLanguage: LoadLanguage;
45
62
  options?: CreateCodemirrorOptions;
63
+ private copyButton;
64
+ private copyButtonContainer;
46
65
  constructor({ view, getPos, node, extensions, languageName, options, }: {
47
66
  node: ProsemirrorNode;
48
67
  view: EditorView$1;
@@ -61,6 +80,22 @@ declare class MfCodemirrorView {
61
80
  private asProseMirrorSelection;
62
81
  private codeMirrorKeymap;
63
82
  private maybeEscape;
83
+ /**
84
+ * Creates the copy button and adds it to the CodeMirror editor
85
+ */
86
+ private createCopyButton;
87
+ /**
88
+ * Sets up event listeners for the copy button
89
+ */
90
+ private setupCopyButtonEvents;
91
+ /**
92
+ * Handles the copy button click event
93
+ */
94
+ private handleCopy;
95
+ /**
96
+ * Shows copy success feedback
97
+ */
98
+ private showCopySuccess;
64
99
  }
65
100
  declare const getLanguageMap: () => Record<string, LanguageDescription>;
66
101
  declare const loadLanguage: (languageName: string) => Promise<LanguageSupport> | LanguageSupport | undefined;
@@ -267,7 +302,7 @@ interface StackItem {
267
302
  attrs?: Record<string, any>;
268
303
  content: Node[];
269
304
  }
270
- type TokenHandler = (state: MarkdownParseState, tok: Token) => void;
305
+ type TokenHandler = (state: MarkdownParseState, tok: Token$1) => void;
271
306
  type TokenHandlers = Record<string, TokenHandler>;
272
307
  declare class MarkdownParseState {
273
308
  private schema;
@@ -282,7 +317,7 @@ declare class MarkdownParseState {
282
317
  private mergeTextNode;
283
318
  openMark(mark: Mark): void;
284
319
  closeMark(mark: Mark): void;
285
- parseTokens(toks: Token[]): void;
320
+ parseTokens(toks: Token$1[]): void;
286
321
  addNode(type: NodeType, attrs?: Record<string, any>, content?: Node[]): Node;
287
322
  openNode(type: NodeType, attrs?: Record<string, any>): void;
288
323
  closeNode(): Node;
@@ -343,6 +378,7 @@ type ExtensionsOptions = {
343
378
  disableAllBuildInShortcuts?: boolean;
344
379
  handleViewImgSrcUrl?: (src: string) => Promise<string>;
345
380
  ai?: AIOptions;
381
+ customCopyFunction?: CustomCopyFunction;
346
382
  };
347
383
  declare function extensions(options: ExtensionsOptions): any[];
348
384
 
@@ -353,7 +389,7 @@ declare const createWysiwygDelegate: (options?: CreateWysiwygDelegateOptions) =>
353
389
 
354
390
  declare const _default: react.NamedExoticComponent<EditorProps>;
355
391
 
356
- interface WarpperProps$1 {
392
+ interface WrapperProps {
357
393
  codeEditor?: boolean;
358
394
  dark?: boolean;
359
395
  /**
@@ -367,7 +403,7 @@ interface WarpperProps$1 {
367
403
  }
368
404
  declare const WysiwygThemeWrapper: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<styled_components_dist_types.Substitute<styled_components_dist_types.Substitute<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
369
405
  ref?: ((instance: HTMLDivElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLDivElement> | null | undefined;
370
- }>, WarpperProps$1>, never>> & string;
406
+ }>, WrapperProps>, never>> & string;
371
407
 
372
408
  interface WarpperProps {
373
409
  codeEditor?: boolean;