@pretextbook/web-editor 0.0.2 → 0.0.4

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 (37) hide show
  1. package/README.md +9 -3
  2. package/dist/App.d.ts +7 -0
  3. package/dist/components/BubbleMenu.d.ts +4 -0
  4. package/dist/components/CodeEditor.d.ts +6 -0
  5. package/dist/components/CodeEditorMenu.d.ts +12 -0
  6. package/dist/components/Editors.d.ts +12 -0
  7. package/dist/components/FloatingMenu.d.ts +4 -0
  8. package/dist/components/FullPreview.d.ts +5 -0
  9. package/dist/components/MenuBar.d.ts +12 -0
  10. package/dist/components/TheoremLike.d.ts +3 -0
  11. package/dist/components/TiptapMenuBar.d.ts +4 -0
  12. package/dist/components/VisualEditor.d.ts +12 -0
  13. package/dist/defaultContent.d.ts +3 -0
  14. package/dist/extensions/AxiomLike.d.ts +3 -0
  15. package/dist/extensions/Blocks.d.ts +3 -0
  16. package/dist/extensions/Definition.d.ts +3 -0
  17. package/dist/extensions/Divisions.d.ts +3 -0
  18. package/dist/extensions/Emph.d.ts +7 -0
  19. package/dist/extensions/ExampleLike.d.ts +3 -0
  20. package/dist/extensions/Inline.d.ts +3 -0
  21. package/dist/extensions/Keyboard.d.ts +3 -0
  22. package/dist/extensions/Math.d.ts +5 -0
  23. package/dist/extensions/RawPtx.d.ts +3 -0
  24. package/dist/extensions/RemarkLike.d.ts +3 -0
  25. package/dist/extensions/Statement.d.ts +3 -0
  26. package/dist/extensions/TheoremLike.d.ts +3 -0
  27. package/dist/extensions/Title.d.ts +3 -0
  28. package/dist/extensions/UnknownMark.d.ts +3 -0
  29. package/dist/extensions/getCursorPos.d.ts +42 -0
  30. package/dist/index.d.ts +6 -0
  31. package/dist/json2ptx.d.ts +2 -0
  32. package/dist/knownTags.d.ts +1 -0
  33. package/dist/main.d.ts +1 -0
  34. package/dist/ptxSourceSlice.d.ts +6 -0
  35. package/dist/utils.d.ts +14 -0
  36. package/dist/web-editor.css +1 -1
  37. package/package.json +6 -3
package/README.md CHANGED
@@ -40,14 +40,20 @@ export default App;
40
40
 
41
41
  ### Styling
42
42
 
43
- The editor includes CSS styles that must be imported. You have two options:
43
+ **Important:** This package uses Tailwind CSS internally, but **all styles are pre-compiled and bundled** in the CSS file. You don't need to install or configure Tailwind CSS in your project.
44
+
45
+ Simply import the CSS file:
44
46
 
45
- **Option 1: Import the CSS file directly** (recommended)
46
47
  ```tsx
47
48
  import '@pretextbook/web-editor/dist/web-editor.css';
48
49
  ```
49
50
 
50
- **Option 2: Import in your CSS file**
51
+ Or in your CSS file:
52
+ ```css
53
+ @import '@pretextbook/web-editor/dist/web-editor.css';
54
+ ```
55
+
56
+ All button styles, layout, and MenuBar styling will work automatically without any additional setup.
51
57
  ```css
52
58
  @import '@pretextbook/web-editor/dist/web-editor.css';
53
59
  ```
package/dist/App.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import 'primereact/resources/themes/lara-light-blue/theme.css';
2
+ import 'primereact/resources/primereact.min.css';
3
+ import 'primeicons/primeicons.css';
4
+ import 'primeflex/primeflex.css';
5
+ import './App.css';
6
+ declare function App(): import("react/jsx-runtime").JSX.Element;
7
+ export default App;
@@ -0,0 +1,4 @@
1
+ import { Editor } from "@tiptap/react";
2
+ export declare const PtxBubbleMenu: ({ editor }: {
3
+ editor: Editor;
4
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ interface CodeEditorProps {
2
+ content: string;
3
+ onChange: (value: string | undefined) => void;
4
+ }
5
+ declare const CodeEditor: ({ content, onChange }: CodeEditorProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default CodeEditor;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './CodeEditorMenu.css';
3
+ interface CodeEditorMenuProps {
4
+ content: string;
5
+ onContentChange: (newContent: string) => void;
6
+ onUndo: () => void;
7
+ onRedo: () => void;
8
+ canUndo: boolean;
9
+ canRedo: boolean;
10
+ }
11
+ declare const CodeEditorMenu: React.FC<CodeEditorMenuProps>;
12
+ export default CodeEditorMenu;
@@ -0,0 +1,12 @@
1
+ export interface editorProps {
2
+ content: string;
3
+ onContentChange: (value: string | undefined) => void;
4
+ title?: string;
5
+ onTitleChange?: (value: string) => void;
6
+ onSaveButton?: () => void;
7
+ saveButtonLabel?: string;
8
+ onCancelButton?: () => void;
9
+ cancelButtonLabel?: string;
10
+ }
11
+ declare const Editors: (props: editorProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default Editors;
@@ -0,0 +1,4 @@
1
+ import { Editor } from "@tiptap/react";
2
+ export declare const PtxFloatingMenu: ({ editor }: {
3
+ editor: Editor;
4
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ interface FullPreviewProps {
2
+ content: string;
3
+ }
4
+ declare const FullPreview: ({ content }: FullPreviewProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default FullPreview;
@@ -0,0 +1,12 @@
1
+ export interface MenuBarProps {
2
+ isChecked: boolean;
3
+ onChange: () => void;
4
+ title?: string;
5
+ onTitleChange?: (value: string) => void;
6
+ onSaveButton?: () => void;
7
+ saveButtonLabel?: string;
8
+ onCancelButton?: () => void;
9
+ cancelButtonLabel?: string;
10
+ }
11
+ declare const MenuBar: (props: MenuBarProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default MenuBar;
@@ -0,0 +1,3 @@
1
+ declare const TheoremLikeComponent: (props: any) => import("react/jsx-runtime").JSX.Element;
2
+ declare const ProofComponent: () => import("react/jsx-runtime").JSX.Element;
3
+ export { TheoremLikeComponent, ProofComponent };
@@ -0,0 +1,4 @@
1
+ import { Editor } from "@tiptap/react";
2
+ export declare const MenuBar: ({ editor }: {
3
+ editor: Editor;
4
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,12 @@
1
+ import "katex/dist/katex.min.css";
2
+ import "../styles.scss";
3
+ interface VisualEditorProps {
4
+ content: string;
5
+ onChange: (html: string) => void;
6
+ }
7
+ interface VisualEditorProps {
8
+ content: string;
9
+ onChange: (html: string) => void;
10
+ }
11
+ declare const VisualEditor: ({ content, onChange }: VisualEditorProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default VisualEditor;
@@ -0,0 +1,3 @@
1
+ declare const defaultContent: string;
2
+ declare const simpleContent: string;
3
+ export { defaultContent, simpleContent };
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const AxiomLike: Extension<any, any>;
3
+ export default AxiomLike;
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const Blocks: Extension<any, any>;
3
+ export default Blocks;
@@ -0,0 +1,3 @@
1
+ import { Node } from "@tiptap/core";
2
+ declare const Definition: Node<any, any>;
3
+ export default Definition;
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const Divisions: Extension<any, any>;
3
+ export default Divisions;
@@ -0,0 +1,7 @@
1
+ import { Node } from "@tiptap/core";
2
+ export declare const inputPTXRegex: RegExp;
3
+ export declare const pastePTXRegex: RegExp;
4
+ export declare const inputMDRegex: RegExp;
5
+ export declare const inputRegex: RegExp;
6
+ declare const Emphasis: Node<any, any>;
7
+ export default Emphasis;
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const ExampleLike: Extension<any, any>;
3
+ export default ExampleLike;
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const Inline: Extension<any, any>;
3
+ export default Inline;
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const KeyboardCommands: Extension<any, any>;
3
+ export default KeyboardCommands;
@@ -0,0 +1,5 @@
1
+ import { Node } from "@tiptap/core";
2
+ declare const MathInline: Node<any, any>;
3
+ declare const MathEquation: Node<any, any>;
4
+ declare const MathDisplay: Node<any, any>;
5
+ export { MathInline, MathEquation, MathDisplay };
@@ -0,0 +1,3 @@
1
+ import { Node } from "@tiptap/core";
2
+ declare const RawPtx: Node<any, any>;
3
+ export default RawPtx;
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const RemarkLike: Extension<any, any>;
3
+ export default RemarkLike;
@@ -0,0 +1,3 @@
1
+ import { Node } from "@tiptap/core";
2
+ declare const Statement: Node<any, any>;
3
+ export default Statement;
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const TheoremLike: Extension<any, any>;
3
+ export default TheoremLike;
@@ -0,0 +1,3 @@
1
+ import { Node } from "@tiptap/core";
2
+ declare const Title: Node<any, any>;
3
+ export default Title;
@@ -0,0 +1,3 @@
1
+ import { Mark } from "@tiptap/core";
2
+ declare const UnknownMark: Mark<any, any>;
3
+ export default UnknownMark;
@@ -0,0 +1,42 @@
1
+ interface CursorPosition {
2
+ pos: () => number;
3
+ depth: () => number;
4
+ inTextNode: () => boolean;
5
+ prevNodeIsText: () => boolean;
6
+ nextNodeIsText: () => boolean;
7
+ parentType: () => string;
8
+ anchor: () => any;
9
+ nextNodeSize: () => number;
10
+ prevNodeSize: () => number;
11
+ }
12
+ interface Editor {
13
+ $pos: (pos: number) => any;
14
+ state: {
15
+ selection: {
16
+ $anchor: {
17
+ pos: number;
18
+ depth: number;
19
+ parent: {
20
+ firstChild: {
21
+ isText: boolean;
22
+ } | null;
23
+ type: {
24
+ name: string;
25
+ };
26
+ };
27
+ nodeBefore: {
28
+ isText: boolean;
29
+ nodeSize: number;
30
+ } | null;
31
+ nodeAfter: {
32
+ type: {
33
+ name: string;
34
+ };
35
+ nodeSize: number;
36
+ } | null;
37
+ };
38
+ };
39
+ };
40
+ }
41
+ export declare const getCursorPos: (editor: Editor) => CursorPosition;
42
+ export {};
@@ -0,0 +1,6 @@
1
+ import './index.css';
2
+ export { default as Editors } from './components/Editors';
3
+ export type { editorProps } from './components/Editors';
4
+ export { default as CodeEditor } from './components/CodeEditor';
5
+ export { default as VisualEditor } from './components/VisualEditor';
6
+ export { default as FullPreview } from './components/FullPreview';
@@ -0,0 +1,2 @@
1
+ declare function json2ptx(json: any): string;
2
+ export { json2ptx };
@@ -0,0 +1 @@
1
+ export declare const KNOWN_TAGS: string[];
package/dist/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1,6 @@
1
+ export declare const setPtxSource: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "ptxSource/setPtxSource">;
2
+ declare const _default: import("redux").Reducer<{
3
+ value: string;
4
+ editor: null;
5
+ }>;
6
+ export default _default;
@@ -0,0 +1,14 @@
1
+ export declare function cleanPtx(origXml: string): string;
2
+ export declare function ptxToJson(xml: string): string;
3
+ export declare function blockAttributes(): {
4
+ label: {
5
+ parseHTML: (element: HTMLElement) => string | null;
6
+ };
7
+ "xml:id": {
8
+ parseHTML: (element: HTMLElement) => string | null;
9
+ };
10
+ component: {
11
+ parseHTML: (element: HTMLElement) => string | null;
12
+ };
13
+ };
14
+ export declare function generateInputRules(prefix: string, nodeType: any): import("@tiptap/core").InputRule[];