@kodaeditor/core 1.0.3 → 1.0.5
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/LICENSE.md +3 -9
- package/README.md +36 -7
- package/dist/docx-import.d.ts +6 -1
- package/dist/docx-placeholders.d.ts +33 -0
- package/dist/editor.d.ts +25 -0
- package/dist/external-shims.d.ts +54 -0
- package/dist/i18n.d.ts +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/kodaeditor-core.umd.cjs +1 -1
- package/dist/kodaeditor.js +1 -1
- package/dist/kodaeditor.umd.cjs +1 -1
- package/dist/license.d.ts +0 -14
- package/dist/web-component.d.ts +17 -2
- package/package.json +2 -38
package/LICENSE.md
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
# KodaEditor
|
|
2
|
-
|
|
3
|
-
> **Status: draft, prepared ahead of public npm publish — has not had a
|
|
4
|
-
> legal review yet.** Placeholder good enough to make `npm pack`/`npm
|
|
5
|
-
> publish` metadata accurate during Phase 1 preparation (see
|
|
6
|
-
> `docs/LAUNCH-ROADMAP_2026-09-01.md`). Get this reviewed by a lawyer
|
|
7
|
-
> before the packages are actually published to the public npm registry.
|
|
1
|
+
# KodaEditor - Commercial License
|
|
8
2
|
|
|
9
3
|
Copyright © the KodaEditor authors. All rights reserved except as
|
|
10
4
|
explicitly granted below.
|
|
@@ -39,7 +33,7 @@ You may not:
|
|
|
39
33
|
- Remove copyright or attribution notices from the Software's source.
|
|
40
34
|
|
|
41
35
|
You may freely use the Software's *output* (the HTML/content your users
|
|
42
|
-
create with it) with no restriction
|
|
36
|
+
create with it) with no restriction - this license covers the editor
|
|
43
37
|
itself, not the documents people write in it.
|
|
44
38
|
|
|
45
39
|
## 5. Ownership
|
|
@@ -80,4 +74,4 @@ issued for it.
|
|
|
80
74
|
---
|
|
81
75
|
|
|
82
76
|
Third-party components bundled inside `@kodaeditor/core` are used under
|
|
83
|
-
their own licenses
|
|
77
|
+
their own licenses - see `packages/core/THIRD-PARTY-LICENSES.txt`.
|
package/README.md
CHANGED
|
@@ -11,17 +11,17 @@ Paste a table from Microsoft Word and it stays a table. Paste a range from Excel
|
|
|
11
11
|
and it arrives as a real table, not a picture. Paste a page from Google Docs and
|
|
12
12
|
the formatting survives.
|
|
13
13
|
|
|
14
|
-
That sounds like
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
That sounds like a baseline, and it is not: pasted Word content loses its merged
|
|
15
|
+
cells, column widths, numbered lists and inline colours quietly, and the user
|
|
16
|
+
notices only later, in the document they already sent. Each item below is here
|
|
17
|
+
because it used to break in this editor and was fixed:
|
|
18
18
|
|
|
19
19
|
- numbered and bulleted lists, including nesting levels and lists inside table cells
|
|
20
20
|
- tables with merged cells, column widths and row heights
|
|
21
21
|
- text colour, highlight, bold, italic, underline, strikethrough
|
|
22
22
|
- paragraph alignment, including numbers aligned inside table cells
|
|
23
|
-
- runs of spaces used for layout,
|
|
24
|
-
- images,
|
|
23
|
+
- runs of spaces used for layout, kept instead of collapsed into one
|
|
24
|
+
- images, including the ones Word hides inside drawing shapes
|
|
25
25
|
|
|
26
26
|
Import is supported directly too: `.docx` (including text inside shapes),
|
|
27
27
|
`.xlsx`, `.csv`, PDF, HTML, Markdown and plain text.
|
|
@@ -53,18 +53,47 @@ verified on your own machine.
|
|
|
53
53
|
No content ever leaves your infrastructure. No account, no tenant, no dashboard
|
|
54
54
|
of ours in the middle.
|
|
55
55
|
|
|
56
|
+
## Your network is a parameter, not a problem
|
|
57
|
+
|
|
58
|
+
Locked-down intranet, corporate proxy, a Content Security Policy you cannot
|
|
59
|
+
change, a laptop with no internet at all - these are the deployments the editor
|
|
60
|
+
was built for, not the ones it tolerates.
|
|
61
|
+
|
|
62
|
+
Rather than bury that in a manual, we made it a questionnaire. Answer five
|
|
63
|
+
questions and get the exact recipe for your case: how to activate the license,
|
|
64
|
+
which files to ship, what to put in your CSP, and which build to take.
|
|
65
|
+
|
|
66
|
+
**[kodaeditor.com/setup](https://kodaeditor.com/setup)**
|
|
67
|
+
|
|
68
|
+
Everything it recommends is a shipped capability, not a roadmap item. If your
|
|
69
|
+
combination genuinely does not work, the page says so instead of selling you a
|
|
70
|
+
workaround.
|
|
71
|
+
|
|
56
72
|
## Trying it without a licence
|
|
57
73
|
|
|
58
74
|
Install it and everything works from the first minute. Nothing is switched off,
|
|
59
75
|
nothing is time-limited, there is no signup, and no feature is held back. The
|
|
60
76
|
Word paste is the part worth testing, so we would rather you tested it properly.
|
|
61
77
|
|
|
62
|
-
Two things mark an unlicensed installation, and neither takes
|
|
78
|
+
Two things mark an unlicensed installation on a public domain, and neither takes
|
|
79
|
+
anything away:
|
|
63
80
|
|
|
64
81
|
1. a watermark across the document and a banner above the editor;
|
|
65
82
|
2. one line appended to everything you export - PDF, Word, HTML, Markdown, plain
|
|
66
83
|
text, CSV - saying the file was created in trial mode.
|
|
67
84
|
|
|
85
|
+
**While you develop, the watermark does not appear.** On localhost, 127.0.0.1
|
|
86
|
+
and the reserved .test and .localhost suffixes the editor runs without it:
|
|
87
|
+
building and evaluating the product is not production use, and we would rather
|
|
88
|
+
you were not looking at a watermark while you decide.
|
|
89
|
+
|
|
90
|
+
The exported line stays even there - a file you send out is a file you send
|
|
91
|
+
out, wherever it was made.
|
|
92
|
+
|
|
93
|
+
Note that .local is treated as production, because in company networks it
|
|
94
|
+
usually is - an internal server such as intranet.company.local serves real
|
|
95
|
+
users and needs a license like any other deployment.
|
|
96
|
+
|
|
68
97
|
Files still open and read normally. There is no limit on size, on how many
|
|
69
98
|
documents you produce, or on which features you use.
|
|
70
99
|
|
package/dist/docx-import.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { type PlaceholderField } from './docx-placeholders';
|
|
2
|
+
export type { PlaceholderField } from './docx-placeholders';
|
|
1
3
|
export interface DocxImportResult {
|
|
2
4
|
html: string;
|
|
3
5
|
warnings: string[];
|
|
6
|
+
contentWarnings: string[];
|
|
7
|
+
placeholderFields: PlaceholderField[];
|
|
4
8
|
}
|
|
5
|
-
export type DocxImportErrorCode = 'corrupt' | 'invalid' | 'parse';
|
|
9
|
+
export type DocxImportErrorCode = 'corrupt' | 'invalid' | 'parse' | 'legacy-doc' | 'archive-io';
|
|
10
|
+
export declare function detectContainerKind(buffer: ArrayBuffer): 'zip' | 'ole2' | 'empty' | 'unknown';
|
|
6
11
|
/**
|
|
7
12
|
* An import failure carrying a message fit to show the user
|
|
8
13
|
* (`userMessage`) alongside a machine-readable reason code. Show
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** A Word template placeholder turned into a field of the document. */
|
|
2
|
+
export interface PlaceholderField {
|
|
3
|
+
/**
|
|
4
|
+
* Stable name for the field. Taken from Word's own `w:tag` when the template
|
|
5
|
+
* author set one, otherwise derived from the control's internal id.
|
|
6
|
+
*/
|
|
7
|
+
key: string;
|
|
8
|
+
/** The text the reader sees - exactly what stood in the Word document. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Word's own caption for the field (`w:alias`), empty when the file has none. */
|
|
11
|
+
hint: string;
|
|
12
|
+
/**
|
|
13
|
+
* Caption WE derived from the text in front of the placeholder («Fax:» before
|
|
14
|
+
* «[Enter number]»), empty when there was nothing to derive it from. Kept
|
|
15
|
+
* apart from `hint` on purpose: «Word said so» and «we worked it out» must
|
|
16
|
+
* stay tellable apart.
|
|
17
|
+
*/
|
|
18
|
+
context: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the key survives an edit of the template. `false` means the key
|
|
21
|
+
* depends on the ORDER of placeholders: inserting a field above shifts it,
|
|
22
|
+
* and a host that stored «this key is the tax ID» will then put the tax ID
|
|
23
|
+
* somewhere else, silently.
|
|
24
|
+
*
|
|
25
|
+
* What `true` states is narrower than it sounds: the identifier is unique
|
|
26
|
+
* WITHIN THIS FILE. Whether Word keeps it across a re-save of the template is
|
|
27
|
+
* not something we have measured.
|
|
28
|
+
*/
|
|
29
|
+
stable: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function markPlaceholdersInDoc(doc: Document): boolean;
|
|
32
|
+
export declare function buildPlaceholderFields(root: HTMLElement): PlaceholderField[];
|
|
33
|
+
export declare function hasPlaceholderMarkup(xml: string): boolean;
|
package/dist/editor.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ export interface EditorOptions {
|
|
|
15
15
|
strings?: Strings;
|
|
16
16
|
/** Called on every change to the document. */
|
|
17
17
|
onChange?: (html: string) => void;
|
|
18
|
+
onImportError?: (message: string) => void;
|
|
19
|
+
onImportWarnings?: (warnings: string[]) => void;
|
|
20
|
+
onUnfilledFields?: (fields: Array<{
|
|
21
|
+
key: string;
|
|
22
|
+
label: string;
|
|
23
|
+
hint: string | null;
|
|
24
|
+
context: string | null;
|
|
25
|
+
stable: boolean;
|
|
26
|
+
}>) => void;
|
|
18
27
|
/** Hooks for the floating table toolbar, so a host can open its own dialog. */
|
|
19
28
|
tableCallbacks?: {
|
|
20
29
|
onSplitCell?: () => void;
|
|
@@ -40,6 +49,9 @@ export interface TableProps {
|
|
|
40
49
|
export declare class Editor {
|
|
41
50
|
readonly view: EditorView;
|
|
42
51
|
private readonly onChange?;
|
|
52
|
+
private readonly onImportError?;
|
|
53
|
+
private readonly onImportWarnings?;
|
|
54
|
+
private readonly onUnfilledFields?;
|
|
43
55
|
private licensed;
|
|
44
56
|
private licenseCheck;
|
|
45
57
|
private readonly strings;
|
|
@@ -233,6 +245,19 @@ export declare class Editor {
|
|
|
233
245
|
insertImage(src: string, alt?: string): void;
|
|
234
246
|
/** Inserts a merge field: an inline chip replaced by a real value later. */
|
|
235
247
|
insertMergeField(key: string, label?: string): void;
|
|
248
|
+
/**
|
|
249
|
+
* Merge fields present in the document, in order - including the ones that
|
|
250
|
+
* came from Word template placeholders. Ask before submitting a form or
|
|
251
|
+
* exporting: a field still standing here means a blank left unfilled.
|
|
252
|
+
*/
|
|
253
|
+
getMergeFields(): Array<{
|
|
254
|
+
key: string;
|
|
255
|
+
label: string;
|
|
256
|
+
hint: string | null;
|
|
257
|
+
context: string | null;
|
|
258
|
+
stable: boolean;
|
|
259
|
+
}>;
|
|
260
|
+
private htmlForExport;
|
|
236
261
|
/**
|
|
237
262
|
* The document's HTML with merge fields expanded to {{key}} placeholders,
|
|
238
263
|
* for systems that substitute values by {{...}} rather than by data
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Generated by scripts/add-type-shims.mjs - do not edit.
|
|
2
|
+
//
|
|
3
|
+
// Declarations for libraries bundled into the build. They let type checking
|
|
4
|
+
// pass on your side without installing those libraries yourself.
|
|
5
|
+
|
|
6
|
+
declare module 'orderedmap' {
|
|
7
|
+
export default class OrderedMap<T = unknown> {
|
|
8
|
+
get(key: string): T | undefined;
|
|
9
|
+
update(key: string, value: T, newKey?: string): OrderedMap<T>;
|
|
10
|
+
remove(key: string): OrderedMap<T>;
|
|
11
|
+
addToStart(key: string, value: T): OrderedMap<T>;
|
|
12
|
+
addToEnd(key: string, value: T): OrderedMap<T>;
|
|
13
|
+
forEach(fn: (key: string, value: T) => void): void;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module 'prosemirror-model' {
|
|
19
|
+
export type NodeSpec = Record<string, unknown>;
|
|
20
|
+
export type MarkSpec = Record<string, unknown>;
|
|
21
|
+
export class Schema<N extends string = string, M extends string = string> {
|
|
22
|
+
readonly nodes: Record<N, unknown>;
|
|
23
|
+
readonly marks: Record<M, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export class Node {
|
|
26
|
+
readonly type: { name: string };
|
|
27
|
+
readonly attrs: Record<string, unknown>;
|
|
28
|
+
readonly childCount: number;
|
|
29
|
+
readonly textContent: string;
|
|
30
|
+
toJSON(): unknown;
|
|
31
|
+
}
|
|
32
|
+
export class Fragment {
|
|
33
|
+
readonly size: number;
|
|
34
|
+
}
|
|
35
|
+
export class DOMParser {
|
|
36
|
+
static fromSchema(schema: Schema): DOMParser;
|
|
37
|
+
parse(dom: globalThis.Node): Node;
|
|
38
|
+
}
|
|
39
|
+
export class DOMSerializer {
|
|
40
|
+
static fromSchema(schema: Schema): DOMSerializer;
|
|
41
|
+
serializeFragment(fragment: Fragment): DocumentFragment;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare module 'prosemirror-view' {
|
|
46
|
+
import type { Node } from 'prosemirror-model';
|
|
47
|
+
export class EditorView {
|
|
48
|
+
readonly dom: HTMLElement;
|
|
49
|
+
readonly state: { doc: Node; tr: unknown };
|
|
50
|
+
dispatch(tr: unknown): void;
|
|
51
|
+
focus(): void;
|
|
52
|
+
destroy(): void;
|
|
53
|
+
}
|
|
54
|
+
}
|
package/dist/i18n.d.ts
CHANGED
|
@@ -110,6 +110,9 @@ export interface Strings {
|
|
|
110
110
|
toolbarHint: string;
|
|
111
111
|
trialExportNotice: string;
|
|
112
112
|
importFailed: string;
|
|
113
|
+
importNothingImported: string;
|
|
114
|
+
importPartialLoss: string;
|
|
115
|
+
exportUnfilledFields: string;
|
|
113
116
|
imageTooBig: string;
|
|
114
117
|
imageWrongType: string;
|
|
115
118
|
imageUploadFailed: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./external-shims.d.ts" />
|
|
1
2
|
/**
|
|
2
3
|
* Entry point of @kodaeditor/core.
|
|
3
4
|
*
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
* works out of the box in any framework and in plain HTML.
|
|
7
8
|
*/
|
|
8
9
|
export { Editor, type EditorOptions } from './editor';
|
|
9
|
-
export { importDocxToHtml, type DocxImportResult, DocxImportError, classifyDocxError, rawTextToHtml, type DocxImportErrorCode, } from './docx-import';
|
|
10
|
+
export { importDocxToHtml, type DocxImportResult, type PlaceholderField, DocxImportError, classifyDocxError, rawTextToHtml, type DocxImportErrorCode, } from './docx-import';
|
|
10
11
|
export { editorSchema } from './schema';
|
|
11
12
|
export { docToHTML, htmlToDoc } from './serialize';
|
|
12
13
|
export { validateLicense, validateLicenseOffline, type LicenseOptions, type OfflineLicenseOptions, type LicenseResult, type LicenseStatus, } from './license';
|