orz-slides-browser 1.2.0 → 1.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 +3 -3
- package/docs/embedding.md +31 -2
- package/esm/orz-slides.browser.mjs +285 -239
- package/index.d.ts +59 -0
- package/orz-slides.browser.js +295 -249
- package/package.json +1 -1
- package/release.json +3 -3
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@ The browser engine and editor component of
|
|
|
5
5
|
Markdown that present, edit and save themselves: the very bundle every
|
|
6
6
|
`.slides.html` file carries, and the same editor for web apps (orz family
|
|
7
7
|
contract FC-19). Built on the carrier kit of
|
|
8
|
-
[orz-markdown](https://www.npmjs.com/package/orz-markdown) 2.
|
|
8
|
+
[orz-markdown](https://www.npmjs.com/package/orz-markdown) 2.10.0 and
|
|
9
9
|
[reveal.js](https://revealjs.com/) 5.2.1 (both bundled: this release embeds
|
|
10
|
-
orz-markdown 2.
|
|
10
|
+
orz-markdown 2.10.0), with the 14 slide themes inside.
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
13
|
npm i orz-slides-browser@1
|
|
@@ -26,7 +26,7 @@ const editor = mountEditor(element, { text, nonce, hooks: { async save(text) { /
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
```html
|
|
29
|
-
<script src="https://cdn.jsdelivr.net/npm/orz-slides-browser@1.
|
|
29
|
+
<script src="https://cdn.jsdelivr.net/npm/orz-slides-browser@1.4.0/orz-slides.browser.js"></script>
|
|
30
30
|
<script>const editor = OrzCarrier.mountEditor(element, { text, hooks: { save } });</script>
|
|
31
31
|
```
|
|
32
32
|
|
package/docs/embedding.md
CHANGED
|
@@ -29,7 +29,7 @@ npm install orz-slides-browser@1 # or: npm i orz-slides-browser@1
|
|
|
29
29
|
| a bundler (Vite, esbuild, webpack) | `import { mountEditor } from 'orz-slides-browser'` | `esm/orz-slides.browser.mjs` (`exports` → `import`) |
|
|
30
30
|
| a plain `<script>` | `<script src=".../orz-slides.browser.js">` → `globalThis.OrzCarrier` | `orz-slides.browser.js` (`exports` → `default`) |
|
|
31
31
|
| `require()` | not supported: it throws, pointing to `import` or `<script>` | `require.cjs` (`exports` → `require`) |
|
|
32
|
-
| the CDN | `https://cdn.jsdelivr.net/npm/orz-slides-browser@<version>/orz-slides.browser.js` (e.g. `@1.
|
|
32
|
+
| the CDN | `https://cdn.jsdelivr.net/npm/orz-slides-browser@<version>/orz-slides.browser.js` (e.g. `@1.4.0`; pin an exact version) | the same IIFE |
|
|
33
33
|
|
|
34
34
|
Types: `orz-slides-browser/index.d.ts` (`Editor`, `EditorOptions`,
|
|
35
35
|
`EditorHooks`, `SlidesTools`, `LayoutOp`, …). The ES module sets no global
|
|
@@ -96,6 +96,35 @@ take the same, and an assembled file keeps the naming in every save and the
|
|
|
96
96
|
update (`extract(html).twinLinks`). With `hooks.resolveLink` links stay as
|
|
97
97
|
written, so your hook gets the source href.
|
|
98
98
|
|
|
99
|
+
**Pages published for readers** (since orz-markdown 2.9, FC-18 §8.2). A
|
|
100
|
+
website that publishes files for readers passes `readerCopy: true` (or `{
|
|
101
|
+
notice: '…' }`, its own plain words) to `assemble`: opened from that site,
|
|
102
|
+
the file's editor says at once that edits can't be saved to the website,
|
|
103
|
+
and its Save reads "Download a copy" and downloads (a downloaded copy is an
|
|
104
|
+
ordinary file). An app that saves its own way can word the editor itself:
|
|
105
|
+
`editor.setWords({ save, saved, notice })` — the Save button's label, the
|
|
106
|
+
toast after a save (`''`: none) and a notice above the panes.
|
|
107
|
+
Since orz-markdown 2.10 `setWords({ status: { clean, dirty } })` words the
|
|
108
|
+
save status too: a clean text's words come with a neutral dot, never the
|
|
109
|
+
green "Saved" (a reader copy reads "Not saved: download to keep").
|
|
110
|
+
|
|
111
|
+
**Saving on your own rhythm** (since orz-markdown 2.7). `hooks.saveStatus({
|
|
112
|
+
dirty, saving })` returns the save status's words (or `{ text, tone }`,
|
|
113
|
+
tone `saved` / `pending` / `unsaved` / `error`); call
|
|
114
|
+
`editor.refreshSaveStatus()` when your own state changes. `foldHeader: false`
|
|
115
|
+
shows the document header as text instead of one folded "Document
|
|
116
|
+
settings" line, and `editor.reveal(target, { select })` brings a range, a
|
|
117
|
+
heading or `#id` into view. All are typed in `index.d.ts`.
|
|
118
|
+
|
|
119
|
+
**Pages of a set** (since orz-markdown 2.10, FC-18 §8.2). A website that
|
|
120
|
+
publishes a set of pages passes each page its place in it: `assemble(text, {
|
|
121
|
+
siteNav: { title, home, previous: { href, label }, next: { href, label } }
|
|
122
|
+
})` (plain-text title and labels; relative or `http(s)` hrefs). The file
|
|
123
|
+
draws a slim bar above the document — the title linking `home`, Previous /
|
|
124
|
+
Next — outside the text and never printed; its saves and quiet update keep
|
|
125
|
+
it, and a copy downloaded from the website keeps it with its links resolved
|
|
126
|
+
against the page's address.
|
|
127
|
+
|
|
99
128
|
### Two ways to edit
|
|
100
129
|
|
|
101
130
|
Both edit the one text, with one undo history; the text stays the single
|
|
@@ -316,7 +345,7 @@ builds its own preview frame with the kit (`orz-markdown/carrier/editor`'s
|
|
|
316
345
|
`PREVIEW_BRIDGE_HASH`, `previewScriptHashes`) must take the hash from the
|
|
317
346
|
same orz-markdown version its frame runs: the bridge, and so its hash,
|
|
318
347
|
differs between kit versions (2.3.0 and 2.4.0 differ; orz-slides 1.0 embeds
|
|
319
|
-
2.4.0, 1.1 embeds 2.5.0, 1.2 embeds 2.7.1). Tested in Chrome: the editor (CodeMirror 6), math,
|
|
348
|
+
2.4.0, 1.1 embeds 2.5.0, 1.2 embeds 2.7.1, 1.3 embeds 2.9.0, 1.4 embeds 2.10.0). Tested in Chrome: the editor (CodeMirror 6), math,
|
|
320
349
|
code highlighting, Mermaid, Chart.js and SMILES render in the preview with
|
|
321
350
|
no violation but one — Mermaid's run-time `<style>` (below).
|
|
322
351
|
|