@pretextbook/web-editor 0.0.10 → 0.0.11
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 +128 -128
- package/dist/App.d.ts +0 -0
- package/dist/components/BubbleMenu.d.ts +0 -0
- package/dist/components/CodeEditor.d.ts +0 -0
- package/dist/components/CodeEditorMenu.d.ts +0 -0
- package/dist/components/Editors.d.ts +0 -0
- package/dist/components/FloatingMenu.d.ts +0 -0
- package/dist/components/FullPreview.d.ts +0 -0
- package/dist/components/MenuBar.d.ts +0 -0
- package/dist/components/TheoremLike.d.ts +0 -0
- package/dist/components/TiptapMenuBar.d.ts +0 -0
- package/dist/components/VisualEditor.d.ts +0 -0
- package/dist/defaultContent.d.ts +0 -0
- package/dist/extensions/AxiomLike.d.ts +0 -0
- package/dist/extensions/Blocks.d.ts +0 -0
- package/dist/extensions/Definition.d.ts +0 -0
- package/dist/extensions/Divisions.d.ts +0 -0
- package/dist/extensions/Emph.d.ts +0 -0
- package/dist/extensions/ExampleLike.d.ts +0 -0
- package/dist/extensions/Inline.d.ts +0 -0
- package/dist/extensions/Keyboard.d.ts +0 -0
- package/dist/extensions/Math.d.ts +0 -0
- package/dist/extensions/RawPtx.d.ts +0 -0
- package/dist/extensions/RemarkLike.d.ts +0 -0
- package/dist/extensions/Statement.d.ts +0 -0
- package/dist/extensions/TheoremLike.d.ts +0 -0
- package/dist/extensions/Title.d.ts +0 -0
- package/dist/extensions/UnknownMark.d.ts +0 -0
- package/dist/extensions/getCursorPos.d.ts +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.es.js +4 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/json2ptx.d.ts +0 -0
- package/dist/knownTags.d.ts +0 -0
- package/dist/main.d.ts +0 -0
- package/dist/ptxSourceSlice.d.ts +0 -0
- package/dist/utils.d.ts +0 -0
- package/dist/web-editor.css +0 -0
- package/package.json +89 -89
package/README.md
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
# PreTeXt Plus Editor
|
|
2
|
-
|
|
3
|
-
An in-browser editor for PreTeXt documents with visual and code editing modes.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @pretextbook/web-editor
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Basic Setup
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import React, { useState } from 'react';
|
|
17
|
-
import { Editors } from '@pretextbook/web-editor';
|
|
18
|
-
import '@pretextbook/web-editor/dist/web-editor.css';
|
|
19
|
-
|
|
20
|
-
function App() {
|
|
21
|
-
const [content, setContent] = useState('');
|
|
22
|
-
const [title, setTitle] = useState('My Document');
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Editors
|
|
26
|
-
content={content}
|
|
27
|
-
onContentChange={setContent}
|
|
28
|
-
title={title}
|
|
29
|
-
onTitleChange={setTitle}
|
|
30
|
-
onSaveButton={() => console.log('Save clicked')}
|
|
31
|
-
saveButtonLabel="Save"
|
|
32
|
-
onCancelButton={() => console.log('Cancel clicked')}
|
|
33
|
-
cancelButtonLabel="Cancel"
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default App;
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Styling
|
|
42
|
-
|
|
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:
|
|
46
|
-
|
|
47
|
-
```tsx
|
|
48
|
-
import '@pretextbook/web-editor/dist/web-editor.css';
|
|
49
|
-
```
|
|
50
|
-
|
|
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.
|
|
57
|
-
```css
|
|
58
|
-
@import '@pretextbook/web-editor/dist/web-editor.css';
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Props
|
|
62
|
-
|
|
63
|
-
The `Editors` component accepts the following props:
|
|
64
|
-
|
|
65
|
-
```tsx
|
|
66
|
-
interface editorProps {
|
|
67
|
-
content: string; // The current PreTeXt content
|
|
68
|
-
onContentChange: (value: string | undefined) => void; // Called when content changes
|
|
69
|
-
title?: string; // Document title
|
|
70
|
-
onTitleChange?: (value: string) => void; // Called when title changes
|
|
71
|
-
onSaveButton?: () => void; // Save button callback
|
|
72
|
-
saveButtonLabel?: string; // Custom save button text
|
|
73
|
-
onCancelButton?: () => void; // Cancel button callback
|
|
74
|
-
cancelButtonLabel?: string; // Custom cancel button text
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Features
|
|
79
|
-
|
|
80
|
-
- **Visual Editor**: Intuitive WYSIWYG editor for PreTeXt documents using Tiptap
|
|
81
|
-
- **Code Editor**: Monaco-powered code editor with syntax highlighting
|
|
82
|
-
- **Full Preview**: Full-page preview of your document
|
|
83
|
-
- **Synchronized Editing**: Changes in one editor instantly reflect in the other
|
|
84
|
-
- **Split View**: View code and visual editor side-by-side
|
|
85
|
-
- **Math Support**: KaTeX support for rendering mathematical expressions
|
|
86
|
-
- **Keyboard Shortcuts**: Intuitive keyboard navigation and commands
|
|
87
|
-
|
|
88
|
-
## Peer Dependencies
|
|
89
|
-
|
|
90
|
-
This package requires:
|
|
91
|
-
- `react` >= 16.8.0
|
|
92
|
-
- `react-dom` >= 16.8.0
|
|
93
|
-
|
|
94
|
-
These must be installed separately in your project.
|
|
95
|
-
|
|
96
|
-
## Browser Support
|
|
97
|
-
|
|
98
|
-
This package requires a modern browser with ES2020 support.
|
|
99
|
-
|
|
100
|
-
## Development
|
|
101
|
-
|
|
102
|
-
For development setup:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
npm install
|
|
106
|
-
npm run dev
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
To build the library:
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
npm run build
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
To build the demo application:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
npm run build:demo
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Publishing
|
|
122
|
-
|
|
123
|
-
See [PUBLISHING.md](./PUBLISHING.md) for instructions on publishing to npm.
|
|
124
|
-
|
|
125
|
-
## License
|
|
126
|
-
|
|
127
|
-
MIT
|
|
128
|
-
|
|
1
|
+
# PreTeXt Plus Editor
|
|
2
|
+
|
|
3
|
+
An in-browser editor for PreTeXt documents with visual and code editing modes.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @pretextbook/web-editor
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Basic Setup
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import React, { useState } from 'react';
|
|
17
|
+
import { Editors } from '@pretextbook/web-editor';
|
|
18
|
+
import '@pretextbook/web-editor/dist/web-editor.css';
|
|
19
|
+
|
|
20
|
+
function App() {
|
|
21
|
+
const [content, setContent] = useState('');
|
|
22
|
+
const [title, setTitle] = useState('My Document');
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Editors
|
|
26
|
+
content={content}
|
|
27
|
+
onContentChange={setContent}
|
|
28
|
+
title={title}
|
|
29
|
+
onTitleChange={setTitle}
|
|
30
|
+
onSaveButton={() => console.log('Save clicked')}
|
|
31
|
+
saveButtonLabel="Save"
|
|
32
|
+
onCancelButton={() => console.log('Cancel clicked')}
|
|
33
|
+
cancelButtonLabel="Cancel"
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default App;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Styling
|
|
42
|
+
|
|
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:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import '@pretextbook/web-editor/dist/web-editor.css';
|
|
49
|
+
```
|
|
50
|
+
|
|
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.
|
|
57
|
+
```css
|
|
58
|
+
@import '@pretextbook/web-editor/dist/web-editor.css';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Props
|
|
62
|
+
|
|
63
|
+
The `Editors` component accepts the following props:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
interface editorProps {
|
|
67
|
+
content: string; // The current PreTeXt content
|
|
68
|
+
onContentChange: (value: string | undefined) => void; // Called when content changes
|
|
69
|
+
title?: string; // Document title
|
|
70
|
+
onTitleChange?: (value: string) => void; // Called when title changes
|
|
71
|
+
onSaveButton?: () => void; // Save button callback
|
|
72
|
+
saveButtonLabel?: string; // Custom save button text
|
|
73
|
+
onCancelButton?: () => void; // Cancel button callback
|
|
74
|
+
cancelButtonLabel?: string; // Custom cancel button text
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Features
|
|
79
|
+
|
|
80
|
+
- **Visual Editor**: Intuitive WYSIWYG editor for PreTeXt documents using Tiptap
|
|
81
|
+
- **Code Editor**: Monaco-powered code editor with syntax highlighting
|
|
82
|
+
- **Full Preview**: Full-page preview of your document
|
|
83
|
+
- **Synchronized Editing**: Changes in one editor instantly reflect in the other
|
|
84
|
+
- **Split View**: View code and visual editor side-by-side
|
|
85
|
+
- **Math Support**: KaTeX support for rendering mathematical expressions
|
|
86
|
+
- **Keyboard Shortcuts**: Intuitive keyboard navigation and commands
|
|
87
|
+
|
|
88
|
+
## Peer Dependencies
|
|
89
|
+
|
|
90
|
+
This package requires:
|
|
91
|
+
- `react` >= 16.8.0
|
|
92
|
+
- `react-dom` >= 16.8.0
|
|
93
|
+
|
|
94
|
+
These must be installed separately in your project.
|
|
95
|
+
|
|
96
|
+
## Browser Support
|
|
97
|
+
|
|
98
|
+
This package requires a modern browser with ES2020 support.
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
For development setup:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm install
|
|
106
|
+
npm run dev
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
To build the library:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm run build
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
To build the demo application:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm run build:demo
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Publishing
|
|
122
|
+
|
|
123
|
+
See [PUBLISHING.md](./PUBLISHING.md) for instructions on publishing to npm.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
|
128
|
+
|
package/dist/App.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/defaultContent.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.es.js
CHANGED
|
@@ -33187,6 +33187,10 @@ const ow = [
|
|
|
33187
33187
|
];
|
|
33188
33188
|
function fw(r) {
|
|
33189
33189
|
let e = r.trim();
|
|
33190
|
+
if (e.startsWith("<?xml")) {
|
|
33191
|
+
const i = e.indexOf("?>");
|
|
33192
|
+
i !== -1 && (e = e.slice(i + 2).trim());
|
|
33193
|
+
}
|
|
33190
33194
|
e = `<ptxdoc>
|
|
33191
33195
|
${e}
|
|
33192
33196
|
</ptxdoc>`;
|