nuvra 0.2.1 → 0.4.0
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 +233 -225
- package/dist/components/document-editor.vue.d.ts +7 -0
- package/dist/components/editor-canvas.vue.d.ts +22 -1
- package/dist/components/editor-context-menu.vue.d.ts +14 -0
- package/dist/components/editor-header-footer.vue.d.ts +12 -0
- package/dist/components/editor-ruler.vue.d.ts +21 -0
- package/dist/components/editor-toolbar.vue.d.ts +5 -1
- package/dist/core/engine/blocks.d.ts +25 -0
- package/dist/core/engine/clipboard.d.ts +5 -0
- package/dist/core/engine/engine.d.ts +46 -2
- package/dist/core/engine/marks.d.ts +9 -0
- package/dist/core/engine/schema.d.ts +4 -0
- package/dist/core/export.d.ts +14 -4
- package/dist/core/icons.d.ts +1 -1
- package/dist/core/labels.d.ts +33 -145
- package/dist/core/locales/en.d.ts +3 -0
- package/dist/core/locales/ru.d.ts +3 -0
- package/dist/core/locales/uz.d.ts +171 -0
- package/dist/core/page.d.ts +51 -0
- package/dist/core/pagination.d.ts +6 -0
- package/dist/core/types.d.ts +1 -1
- package/dist/core/ui-state.d.ts +13 -1
- package/dist/editor.vue.d.ts +4 -0
- package/dist/export-VeTfgCEp.js +117 -0
- package/dist/export-VeTfgCEp.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3597 -2132
- package/dist/index.js.map +1 -1
- package/dist/{page-CEEleKNI.js → page-DL7Oj2o8.js} +23 -4
- package/dist/page-DL7Oj2o8.js.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/export-cyOnlakM.js +0 -59
- package/dist/export-cyOnlakM.js.map +0 -1
- package/dist/page-CEEleKNI.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,225 +1,233 @@
|
|
|
1
|
-
# nuvra
|
|
2
|
-
|
|
3
|
-
Word-style document editor for Vue 3. A real page view with paper sizes and margins, a lighter web view for
|
|
4
|
-
forms, tables, images, lists, find & replace, HTML source mode, printing and export to HTML or Word (`.doc`).
|
|
5
|
-
|
|
6
|
-
**[Documentation and live demo →](https://nuvra-docs.vercel.app)**
|
|
7
|
-
|
|
8
|
-
- No editor framework underneath: its own small editing engine with a sanitizing schema.
|
|
9
|
-
- No UI framework either: native HTML controls, built-in SVG icons and plain CSS variables. Vue is the only
|
|
10
|
-
dependency.
|
|
11
|
-
- Pagination in the page view (A4, A5, Letter, …, portrait or landscape).
|
|
12
|
-
- Tables with merge / split, images with resize and alignment, task lists, links, colors, fonts.
|
|
13
|
-
- Undo / redo, keyboard shortcuts that work with non-Latin keyboard layouts, Markdown-like input rules.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
|
|
102
|
-
`
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
| `--nuvra-
|
|
188
|
-
| `--nuvra-
|
|
189
|
-
| `--nuvra-
|
|
190
|
-
| `--nuvra-
|
|
191
|
-
| `--nuvra-
|
|
192
|
-
| `--nuvra-
|
|
193
|
-
| `--nuvra-
|
|
194
|
-
| `--nuvra-
|
|
195
|
-
| `--nuvra-
|
|
196
|
-
| `--nuvra-
|
|
197
|
-
| `--nuvra-
|
|
198
|
-
| `--nuvra-
|
|
199
|
-
| `--nuvra-
|
|
200
|
-
| `--nuvra-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
1
|
+
# nuvra
|
|
2
|
+
|
|
3
|
+
Word-style document editor for Vue 3. A real page view with paper sizes and margins, a lighter web view for
|
|
4
|
+
forms, tables, images, lists, find & replace, HTML source mode, printing and export to HTML or Word (`.doc`).
|
|
5
|
+
|
|
6
|
+
**[Documentation and live demo →](https://nuvra-docs.vercel.app)**
|
|
7
|
+
|
|
8
|
+
- No editor framework underneath: its own small editing engine with a sanitizing schema.
|
|
9
|
+
- No UI framework either: native HTML controls, built-in SVG icons and plain CSS variables. Vue is the only
|
|
10
|
+
dependency.
|
|
11
|
+
- Pagination in the page view (A4, A5, Letter, …, portrait or landscape).
|
|
12
|
+
- Tables with merge / split, images with resize and alignment, task lists, links, colors, fonts.
|
|
13
|
+
- Undo / redo, keyboard shortcuts that work with non-Latin keyboard layouts, Markdown-like input rules.
|
|
14
|
+
- Office tools: format painter, letter case, paragraph spacing, formatting marks, a right-click menu and
|
|
15
|
+
Ctrl + wheel zoom.
|
|
16
|
+
- Headers and footers with page number, page count, date and title tokens; printing breaks the pages exactly where
|
|
17
|
+
the editor shows them, and the Word export uses Word's own header, footer and page fields.
|
|
18
|
+
- A ruler above the page for the margins and for the first line, left and right indents of a paragraph.
|
|
19
|
+
- A page watermark such as DRAFT or COPY, drawn behind the text of every page and carried into print, HTML and Word.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
pnpm add nuvra
|
|
25
|
+
# or
|
|
26
|
+
npm install nuvra
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`vue` (3.5+) is the only peer dependency.
|
|
30
|
+
|
|
31
|
+
Import the styles once, for example in `main.ts`:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import 'nuvra/style.css';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
### Document editor
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import { ref } from 'vue';
|
|
44
|
+
import { DocumentEditor, type PageSettings, createPageSettings } from 'nuvra';
|
|
45
|
+
|
|
46
|
+
const html = ref('');
|
|
47
|
+
const page = ref<PageSettings>(createPageSettings());
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<DocumentEditor v-model="html" v-model:page="page" height="100%" title="Contract" />
|
|
52
|
+
</template>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Form field
|
|
56
|
+
|
|
57
|
+
`Editor` is the same editor in the web view, growing with its content between `minHeight` and `maxHeight`:
|
|
58
|
+
|
|
59
|
+
```vue
|
|
60
|
+
<script setup lang="ts">
|
|
61
|
+
import { ref } from 'vue';
|
|
62
|
+
import { Editor } from 'nuvra';
|
|
63
|
+
|
|
64
|
+
const description = ref('');
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<Editor v-model="description" placeholder="Description" :max-length="2000" />
|
|
69
|
+
</template>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Image upload
|
|
73
|
+
|
|
74
|
+
Without an upload handler images are embedded as data URLs. Pass `uploadImage` to store them on your server:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import type { DocumentImageUploadHandler } from 'nuvra';
|
|
78
|
+
|
|
79
|
+
const uploadImage: DocumentImageUploadHandler = async file => {
|
|
80
|
+
const body = new FormData();
|
|
81
|
+
body.append('file', file);
|
|
82
|
+
const response = await fetch('/api/files', { method: 'POST', body });
|
|
83
|
+
return (await response.json()).url;
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## API
|
|
88
|
+
|
|
89
|
+
### `DocumentEditor` props
|
|
90
|
+
|
|
91
|
+
| Prop | Type | Default | Description |
|
|
92
|
+
| ----------------- | --------------------------------- | -------- | -------------------------------------------------------------------------- |
|
|
93
|
+
| `v-model` | `string` | `''` | Document HTML; an empty document is an empty string. |
|
|
94
|
+
| `v-model:page` | `PageSettings` | A4 | Paper size, orientation and margins. |
|
|
95
|
+
| `autofocus` | `boolean` | `false` | Places the caret at the end of the document once ready. |
|
|
96
|
+
| `canvasPadding` | `number \| string` | `50` | Gray space around the page or web sheet. |
|
|
97
|
+
| `defaultViewMode` | `'page' \| 'web'` | `'page'` | View shown first. |
|
|
98
|
+
| `disabled` | `boolean` | `false` | Read-only document, disabled controls. |
|
|
99
|
+
| `height` | `number \| string` | `760` | Height of the editor, or `'auto'` to grow between `minHeight`/`maxHeight`. |
|
|
100
|
+
| `locale` | `EditorLocale \| 'uz' \| 'en' \| 'ru'` | — | Interface language; defaults to the app-wide language (Uzbek). |
|
|
101
|
+
| `minHeight` | `number \| string` | `240` | Smallest height of an auto-height editor. |
|
|
102
|
+
| `maxHeight` | `number \| string` | `600` | Largest height of an auto-height editor. |
|
|
103
|
+
| `maxImageSizeMb` | `number` | `10` | Largest accepted image file. |
|
|
104
|
+
| `maxLength` | `number` | `0` | Character limit; `0` means unlimited. |
|
|
105
|
+
| `placeholder` | `string` | `''` | Text shown while the document is empty. |
|
|
106
|
+
| `title` | `string` | `''` | Print title and exported file name. |
|
|
107
|
+
| `uploadImage` | `(file: File) => Promise<string>` | — | Uploads an image and resolves with its URL. |
|
|
108
|
+
|
|
109
|
+
`Editor` accepts the same props except `v-model:page`, `defaultViewMode`, `height` and `title`.
|
|
110
|
+
|
|
111
|
+
Numbers are pixels; strings are used as CSS lengths (`'100%'`, `'50vh'`).
|
|
112
|
+
|
|
113
|
+
### Events
|
|
114
|
+
|
|
115
|
+
| Event | Payload | Description |
|
|
116
|
+
| ------------- | ---------------- | ------------------------------------------------- |
|
|
117
|
+
| `focus` | — | The document received focus. |
|
|
118
|
+
| `blur` | — | The document lost focus; the model is up to date. |
|
|
119
|
+
| `uploadError` | `error: unknown` | An image was rejected or its upload failed. |
|
|
120
|
+
|
|
121
|
+
### Exposed methods (`DocumentEditor` ref)
|
|
122
|
+
|
|
123
|
+
| Method | Description |
|
|
124
|
+
| -------------- | ---------------------------------------------------------------- |
|
|
125
|
+
| `focus()` | Moves keyboard focus into the document. |
|
|
126
|
+
| `getHTML()` | Returns the document HTML, including edits not yet in the model. |
|
|
127
|
+
| `print()` | Opens the browser print dialog. |
|
|
128
|
+
| `exportHtml()` | Downloads the document as an HTML page. |
|
|
129
|
+
| `exportWord()` | Downloads the document as a Word-compatible `.doc` file. |
|
|
130
|
+
| `engine` | The editing engine, for advanced integrations. |
|
|
131
|
+
|
|
132
|
+
### Keyboard shortcuts
|
|
133
|
+
|
|
134
|
+
`Ctrl/⌘+B`, `I`, `U` — bold, italic, underline · `Ctrl/⌘+Shift+H` — highlight · `Ctrl/⌘+Z`, `Ctrl/⌘+Shift+Z` — undo,
|
|
135
|
+
redo · `Ctrl/⌘+F` — find · `Ctrl/⌘+H` — replace · `Ctrl/⌘+K` — link · `Ctrl/⌘+P` — print.
|
|
136
|
+
|
|
137
|
+
The full list, with Markdown-like input rules, is in the
|
|
138
|
+
[keyboard shortcuts guide](https://nuvra-docs.vercel.app/docs/keyboard-shortcuts).
|
|
139
|
+
|
|
140
|
+
## Languages
|
|
141
|
+
|
|
142
|
+
The interface ships in Uzbek (`uz`, the default), English (`en`) and Russian (`ru`). The translations are part of
|
|
143
|
+
the package and cannot be changed from outside; an app only picks the language.
|
|
144
|
+
|
|
145
|
+
For one editor, pass the locale (or just its code) to the `locale` prop:
|
|
146
|
+
|
|
147
|
+
```vue
|
|
148
|
+
<script setup lang="ts">
|
|
149
|
+
import { DocumentEditor, ru } from 'nuvra';
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<template>
|
|
153
|
+
<DocumentEditor v-model="html" :locale="ru" />
|
|
154
|
+
</template>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
For the whole app, call `setEditorLocale` once, for example in `main.ts`. It is reactive, so calling it again from a
|
|
158
|
+
language switcher updates editors already on the page:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
import { en, setEditorLocale } from 'nuvra';
|
|
162
|
+
|
|
163
|
+
setEditorLocale(en);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The `locale` prop wins over `setEditorLocale`; without either the editor is in Uzbek. `editorLocales` lists every
|
|
167
|
+
built-in locale with its name, for language pickers.
|
|
168
|
+
|
|
169
|
+
## Theming
|
|
170
|
+
|
|
171
|
+
Colors come from CSS variables declared on `.document-editor` with zero specificity, so any rule that targets
|
|
172
|
+
`.document-editor` overrides them, whatever order the stylesheets load in. Set them on the editor element itself:
|
|
173
|
+
values on an ancestor such as `body` do not apply, because the editor declares its own.
|
|
174
|
+
|
|
175
|
+
```css
|
|
176
|
+
.document-editor {
|
|
177
|
+
--nuvra-color-primary: #7c3aed;
|
|
178
|
+
--nuvra-color-primary-hover: #8b5cf6;
|
|
179
|
+
--nuvra-color-primary-border: #c4b5fd;
|
|
180
|
+
--nuvra-color-primary-muted: #ddd6fe;
|
|
181
|
+
--nuvra-color-primary-soft: #f5f3ff;
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
| Variable | Used for |
|
|
186
|
+
| ------------------------------- | ---------------------------------------------------- |
|
|
187
|
+
| `--nuvra-color-primary` | Active buttons, focus, primary buttons, selection |
|
|
188
|
+
| `--nuvra-color-primary-hover` | Hovered primary buttons |
|
|
189
|
+
| `--nuvra-color-primary-border` | Focused editor frame, disabled primary buttons |
|
|
190
|
+
| `--nuvra-color-primary-muted` | Table size preview, hovered button borders |
|
|
191
|
+
| `--nuvra-color-primary-soft` | Active button and menu item backgrounds |
|
|
192
|
+
| `--nuvra-color-on-primary` | Text on primary buttons |
|
|
193
|
+
| `--nuvra-color-danger` | Destructive actions, character limit reached |
|
|
194
|
+
| `--nuvra-color-danger-soft` | Hovered destructive actions |
|
|
195
|
+
| `--nuvra-text-strong` | Headings in forms |
|
|
196
|
+
| `--nuvra-text` | Regular text and icons |
|
|
197
|
+
| `--nuvra-text-muted` | Labels, captions, status bar |
|
|
198
|
+
| `--nuvra-text-placeholder` | Placeholders, shortcut hints |
|
|
199
|
+
| `--nuvra-text-disabled` | Disabled buttons |
|
|
200
|
+
| `--nuvra-border` | Editor frame, inputs |
|
|
201
|
+
| `--nuvra-border-hover` | Hovered inputs |
|
|
202
|
+
| `--nuvra-border-light` | Popovers and floating panels |
|
|
203
|
+
| `--nuvra-border-lighter` | Dividers |
|
|
204
|
+
| `--nuvra-fill` | Hovered buttons, segmented controls |
|
|
205
|
+
| `--nuvra-bg` | Toolbar, status bar, inputs |
|
|
206
|
+
| `--nuvra-bg-overlay` | Popovers, menus, find bar |
|
|
207
|
+
| `--nuvra-shadow` | Popovers and floating panels |
|
|
208
|
+
| `--nuvra-fullscreen-z-index` | Stacking order of the fullscreen editor (`2000`) |
|
|
209
|
+
|
|
210
|
+
A dark palette is applied when an ancestor (usually `<html>`) has the `dark` class or `data-theme="dark"`. To change
|
|
211
|
+
dark values separately, target `.dark .document-editor`.
|
|
212
|
+
|
|
213
|
+
To follow an Element Plus theme, map the variables to its own:
|
|
214
|
+
|
|
215
|
+
```css
|
|
216
|
+
.document-editor {
|
|
217
|
+
--nuvra-color-primary: var(--el-color-primary);
|
|
218
|
+
--nuvra-color-primary-soft: var(--el-color-primary-light-9);
|
|
219
|
+
--nuvra-text: var(--el-text-color-regular);
|
|
220
|
+
--nuvra-border: var(--el-border-color);
|
|
221
|
+
--nuvra-bg: var(--el-bg-color);
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Browser support
|
|
226
|
+
|
|
227
|
+
Popovers, menus and bubble toolbars use the [Popover API](https://developer.mozilla.org/docs/Web/API/Popover_API)
|
|
228
|
+
(Chrome/Edge 114+, Safari 17+, Firefox 125+), which keeps them above dialogs and the fullscreen editor. Older browsers
|
|
229
|
+
show them as fixed elements instead. Search highlighting uses the CSS Custom Highlight API.
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
[MIT](./LICENSE). Icon shapes come from [Lucide](https://lucide.dev) (ISC).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DocumentEngine } from '../core/engine/engine';
|
|
2
|
+
import { type EditorLocaleInput } from '../core/labels';
|
|
2
3
|
import { type DocumentViewMode, type PageSettings } from '../core/page';
|
|
3
4
|
import type { DocumentImageUploadHandler } from '../core/types';
|
|
4
5
|
import '../styles/document-content.css';
|
|
@@ -16,6 +17,8 @@ interface Props {
|
|
|
16
17
|
disabled?: boolean;
|
|
17
18
|
/** Height of the whole editor, or `'auto'` to grow with the content between `minHeight` and `maxHeight`. */
|
|
18
19
|
height?: CssSize;
|
|
20
|
+
/** Interface language: a built-in locale (`uz`, `en`, `ru`) or its code; defaults to the app-wide language. */
|
|
21
|
+
locale?: EditorLocaleInput;
|
|
19
22
|
/** Largest height of an auto-height editor; longer documents scroll inside it. */
|
|
20
23
|
maxHeight?: CssSize;
|
|
21
24
|
/** Largest accepted image file, in megabytes. */
|
|
@@ -26,6 +29,8 @@ interface Props {
|
|
|
26
29
|
minHeight?: CssSize;
|
|
27
30
|
/** Text shown while the document is empty; falls back to the translated default placeholder. */
|
|
28
31
|
placeholder?: string;
|
|
32
|
+
/** Shows the ruler above the sheet in the page view; users can also toggle it in the document menu. */
|
|
33
|
+
ruler?: boolean;
|
|
29
34
|
/** Used as the print title and the exported file name. */
|
|
30
35
|
title?: string;
|
|
31
36
|
/** Uploads an inserted image and resolves with its URL; without it images are embedded as data URLs. */
|
|
@@ -67,6 +72,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
67
72
|
}>, {
|
|
68
73
|
title: string;
|
|
69
74
|
height: CssSize;
|
|
75
|
+
ruler: boolean;
|
|
70
76
|
placeholder: string;
|
|
71
77
|
disabled: boolean;
|
|
72
78
|
minHeight: CssSize;
|
|
@@ -75,6 +81,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
75
81
|
autofocus: boolean;
|
|
76
82
|
canvasPadding: CssSize;
|
|
77
83
|
defaultViewMode: DocumentViewMode;
|
|
84
|
+
locale: EditorLocaleInput;
|
|
78
85
|
maxImageSizeMb: number;
|
|
79
86
|
uploadImage: DocumentImageUploadHandler;
|
|
80
87
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,16 +1,31 @@
|
|
|
1
|
+
import type { ParagraphIndents } from '../core/engine/blocks';
|
|
1
2
|
import type { DocumentEngine } from '../core/engine/engine';
|
|
2
|
-
import type
|
|
3
|
+
import { type DocumentViewMode, type PageHeaderFooter, type PageMargins, type PageMetrics, type PageWatermark } from '../core/page';
|
|
3
4
|
interface Props {
|
|
4
5
|
/** Grow with the content between the editor's min and max height instead of filling a fixed height. */
|
|
5
6
|
autoHeight: boolean;
|
|
7
|
+
/** Read-only document: the ruler is shown but cannot be dragged. */
|
|
8
|
+
disabled: boolean | undefined;
|
|
9
|
+
/** Document title, used by the `{title}` token of the header and footer. */
|
|
10
|
+
documentTitle: string;
|
|
6
11
|
/** Engine working on the editable element; `null` until the parent has created it. */
|
|
7
12
|
engine: DocumentEngine | null;
|
|
13
|
+
/** Text repeated in the bottom margin of every sheet. */
|
|
14
|
+
footer?: PageHeaderFooter;
|
|
15
|
+
/** Text repeated in the top margin of every sheet. */
|
|
16
|
+
header?: PageHeaderFooter;
|
|
17
|
+
/** Indents of the paragraph at the caret, shown by the ruler. */
|
|
18
|
+
indents: ParagraphIndents;
|
|
8
19
|
/** Page size and margins in pixels. */
|
|
9
20
|
metrics: PageMetrics;
|
|
10
21
|
/** Number of sheets drawn behind the content in page view. */
|
|
11
22
|
pageCount: number;
|
|
23
|
+
/** Whether the ruler is drawn above the sheet; it is only ever shown in the page view. */
|
|
24
|
+
rulerVisible: boolean;
|
|
12
25
|
/** Paginated sheets or a single web sheet. */
|
|
13
26
|
viewMode: DocumentViewMode;
|
|
27
|
+
/** Watermark drawn behind the text of every sheet. */
|
|
28
|
+
watermark?: PageWatermark;
|
|
14
29
|
/** Zoom in percent. */
|
|
15
30
|
zoom: number;
|
|
16
31
|
}
|
|
@@ -23,8 +38,14 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {
|
|
|
23
38
|
scrollElement: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
24
39
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
40
|
resize: (contentWidth: number) => any;
|
|
41
|
+
zoom: (delta: number) => any;
|
|
42
|
+
updateMargins: (margins: Pick<PageMargins, "right" | "left">) => any;
|
|
43
|
+
updateIndents: (indents: Partial<ParagraphIndents>) => any;
|
|
26
44
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
27
45
|
onResize?: ((contentWidth: number) => any) | undefined;
|
|
46
|
+
onZoom?: ((delta: number) => any) | undefined;
|
|
47
|
+
onUpdateMargins?: ((margins: Pick<PageMargins, "right" | "left">) => any) | undefined;
|
|
48
|
+
onUpdateIndents?: ((indents: Partial<ParagraphIndents>) => any) | undefined;
|
|
28
49
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
50
|
declare const _default: typeof __VLS_export;
|
|
30
51
|
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DocumentEngine } from '../core/engine/engine';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** A read-only document only offers copying and selecting. */
|
|
4
|
+
disabled: boolean | undefined;
|
|
5
|
+
/** Engine the entries act on. */
|
|
6
|
+
engine: DocumentEngine;
|
|
7
|
+
}
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
editLink: () => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
11
|
+
onEditLink?: (() => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PageSettings } from '../core/page';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Settings currently applied to the document. */
|
|
4
|
+
page: PageSettings;
|
|
5
|
+
}
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
change: (page: PageSettings) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
9
|
+
onChange?: ((page: PageSettings) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ParagraphIndents } from '../core/engine/blocks';
|
|
2
|
+
import type { PageMargins, PageMetrics } from '../core/page';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Read-only documents show the ruler but do not let it be dragged. */
|
|
5
|
+
disabled: boolean | undefined;
|
|
6
|
+
/** Indents of the paragraph at the caret, in pixels. */
|
|
7
|
+
indents: ParagraphIndents;
|
|
8
|
+
/** Page geometry in pixels. */
|
|
9
|
+
metrics: PageMetrics;
|
|
10
|
+
/** Zoom in percent, which the ruler is drawn at. */
|
|
11
|
+
zoom: number;
|
|
12
|
+
}
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
updateMargins: (margins: Pick<PageMargins, "right" | "left">) => any;
|
|
15
|
+
updateIndents: (indents: Partial<ParagraphIndents>) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
17
|
+
onUpdateMargins?: ((margins: Pick<PageMargins, "right" | "left">) => any) | undefined;
|
|
18
|
+
onUpdateIndents?: ((indents: Partial<ParagraphIndents>) => any) | undefined;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DocumentEngine } from '../core/engine/engine';
|
|
2
|
-
import type
|
|
2
|
+
import { type PageSettings } from '../core/page';
|
|
3
3
|
import type { DocumentMenuAction } from '../core/types';
|
|
4
4
|
import { type EditorUiState } from '../core/ui-state';
|
|
5
5
|
interface Props {
|
|
@@ -11,8 +11,12 @@ interface Props {
|
|
|
11
11
|
findOpen: boolean;
|
|
12
12
|
/** Whether the editor is in fullscreen, used for the menu item label. */
|
|
13
13
|
fullscreen: boolean;
|
|
14
|
+
/** Whether the formatting marks (pilcrows) are shown in the document. */
|
|
15
|
+
marksVisible: boolean;
|
|
14
16
|
/** Current page settings, edited in the page setup popover. */
|
|
15
17
|
page: PageSettings;
|
|
18
|
+
/** Whether the ruler is shown above the sheet. */
|
|
19
|
+
rulerVisible: boolean;
|
|
16
20
|
/** Whether the HTML source is shown; formatting controls are disabled meanwhile. */
|
|
17
21
|
sourceMode: boolean;
|
|
18
22
|
/** Formatting at the caret, used for active states and labels. */
|