@domternal/core 0.13.0 → 0.15.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 CHANGED
@@ -78,6 +78,47 @@ const editor = new Editor({
78
78
  });
79
79
  ```
80
80
 
81
+ ## Presets
82
+
83
+ `preset: 'notion'` switches the editor to the Notion-style experience in one option. It paints
84
+ the `dm-notion-mode` class on the `.dm-editor` host for you, and preset-aware code follows it:
85
+ the bubble menu serves the Notion text context, and images offer align controls instead of
86
+ float. `'classic'` is the default.
87
+
88
+ ```ts
89
+ const editor = new Editor({
90
+ element: document.getElementById('editor')!,
91
+ extensions: [StarterKit],
92
+ preset: 'notion',
93
+ });
94
+ ```
95
+
96
+ `editor.preset` reports the resolved value, and still reports `'notion'` for a host that carries
97
+ the theme class alone, so setups that predate the option are unaffected.
98
+
99
+ ## Printing
100
+
101
+ `Print` is not part of `StarterKit`, so add it explicitly. `printDocument()` isolates the
102
+ document from the host page before the browser's dialog opens, leaving your application's
103
+ sidebar, header, and everything else beside the document off the page, and it emits
104
+ `beforePrint` and `afterPrint` so you can set `document.title` or add page rules first.
105
+
106
+ ```ts
107
+ import { Editor, StarterKit, Print } from '@domternal/core';
108
+
109
+ const editor = new Editor({
110
+ element: document.getElementById('editor')!,
111
+ extensions: [StarterKit, Print],
112
+ });
113
+
114
+ editor.commands.printDocument();
115
+ ```
116
+
117
+ The hiding itself is CSS, and it lives in
118
+ [`@domternal/theme`](https://www.npmjs.com/package/@domternal/theme), whose paper layer also
119
+ applies to the reader's own Ctrl/Cmd+P with no code involved. Set `isolateNativePrint: true` to
120
+ give that shortcut the same isolation as the command.
121
+
81
122
  ## SSR
82
123
 
83
124
  The `generateHTML`, `generateJSON`, and `generateText` helpers render content