@appsoftwareltd/etherpk-extension-api 0.14.0 → 0.14.1

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
@@ -54,7 +54,8 @@ documentation says which, with `@public` for Stable and `@beta` for Proposed.
54
54
  it. In an extension installed from the Extension Directory, a call to a Proposed member throws an
55
55
  error that names it.
56
56
 
57
- Since 0.14.0 every part is Stable but `contributions` (see *Proposed parts* below). An extension
57
+ Since 0.14.0 every part is Stable but `contributions` and an inline panel's `lineText` (see
58
+ *Proposed parts* below). An extension
58
59
  listed in the Extension Directory uses only the Stable part.
59
60
  [`etc/etherpk-extension-api.public.api.md`](etc/etherpk-extension-api.public.api.md) lists the
60
61
  Stable part, and [`etc/etherpk-extension-api.beta.api.md`](etc/etherpk-extension-api.beta.api.md)
@@ -295,7 +296,9 @@ Protected Document, or a caret in the frontmatter, in a fence or in a table.
295
296
  `context.editor.openPanel({ mount, at })` draws a panel of the extension's own in the document,
296
297
  beneath the caret's line, or beneath the document's last line with `at: 'end'`, without changing
297
298
  the text. It returns null where no panel can go, by the same rules as `insertBlock`. A panel closes
298
- when the extension stops.
299
+ when the extension stops. The panel's `insertBlock` puts a block at its line: beneath a bullet with
300
+ text as the bullet's first child, after its own lines. A block that would rearrange the outline
301
+ around it, from `insertBlock` here or at the caret, is refused, and the call returns false.
299
302
 
300
303
  ### Context Menu rows and Command Bar buttons
301
304
 
@@ -502,11 +505,14 @@ code runs under them.
502
505
 
503
506
  ## Proposed parts
504
507
 
505
- The one Proposed part is `contributions`, which reaches the Client's own registries by kind. Only
506
- the extensions that come with EtherPK may use it, and it stays Proposed for good: its kinds and
507
- their values are the Client's internals, which change between releases, and through it one
508
- extension could take another's entries. Where an extension from another Publisher needs what a
509
- registry gives, the Client adds a checked part for it, as it did for fences and Journal Panels.
508
+ `contributions` reaches the Client's own registries by kind. Only the extensions that come with
509
+ EtherPK may use it, and it stays Proposed for good: its kinds and their values are the Client's
510
+ internals, which change between releases, and through it one extension could take another's
511
+ entries. Where an extension from another Publisher needs what a registry gives, the Client adds a
512
+ checked part for it, as it did for fences and Journal Panels.
513
+
514
+ An inline panel's `lineText()`, the text of the bullet the panel opened on, is Proposed while
515
+ Agent Chat is its only user, and becomes Stable when an extension from another Publisher needs it.
510
516
 
511
517
  ## Trying an extension
512
518
 
package/dist/editor.d.ts CHANGED
@@ -255,10 +255,12 @@ export interface InlinePanel {
255
255
  * Put a block at the panel's line, by the rule {@link ExtensionEditor.insertBlock} follows at the
256
256
  * caret: an empty line is replaced, an empty bullet takes an outline's place at its own
257
257
  * indentation (or any other block as its content), and after any other line the block goes on new
258
- * lines beneath at the line's content column. The panel then sits beneath the block, and the next
259
- * block goes after it at the indentation of its first line. One undoable change. False where
260
- * nothing was put in: the panel is closed, its editor has closed, or its line is now in the
261
- * frontmatter, a fenced block or a table.
258
+ * lines beneath at the line's content column. Beneath a bullet with text it goes in as the
259
+ * bullet's first child, after the bullet's own lines and at its children's indentation. The panel
260
+ * then sits beneath the block, and the next block goes after it at the indentation of its first
261
+ * line. One undoable change. False where nothing was put in: the panel is closed, its editor has
262
+ * closed, its line is now in the frontmatter, a fenced block or a table, or the block would
263
+ * rearrange the outline around it (an indented heading, say, or a blank line that ends a branch).
262
264
  */
263
265
  insertBlock(text: string): boolean;
264
266
  /** Bring the panel into view. */
@@ -275,6 +277,15 @@ export interface InlinePanel {
275
277
  * the line is not a bullet, or the panel is closed or under the document's last line.
276
278
  */
277
279
  outline(): string | null;
280
+ /**
281
+ * The text of the bullet the panel opened on, as it was when the panel opened: without its
282
+ * bullet marker or a task's box, its continuation lines joined with line breaks. Null when the
283
+ * panel opened on an empty bullet, on a line that is not a bullet, or under the document's last
284
+ * line. An Agent Chat opened with `/Agent` on a line with text starts with this as its prompt.
285
+ *
286
+ * @beta
287
+ */
288
+ lineText(): string | null;
278
289
  /** Close the panel. Its `onClose` is told. */
279
290
  close(): void;
280
291
  }
@@ -322,9 +333,11 @@ export interface ExtensionEditor {
322
333
  * Put a block at the caret of the editor the person is working in, as a code block or a table
323
334
  * goes in: an empty bullet takes it as its content, an empty line is replaced, and after any other
324
335
  * line it goes on new lines beneath at the line's content column. `text` is the block's lines
325
- * without indentation. A block that is a fence leaves the caret outside it, and with `focus` its
326
- * widget is told to `takeFocus`. False where nothing was put in: no editor, a body that cannot be
327
- * written, or a caret in the frontmatter, a fence or a table.
336
+ * without indentation. A blank line inside the block takes the indentation of the line after it,
337
+ * so the block stays one branch. A block that is a fence leaves the caret outside it, and with
338
+ * `focus` its widget is told to `takeFocus`. False where nothing was put in: no editor, a body
339
+ * that cannot be written, a caret in the frontmatter, a fence or a table, or a block that would
340
+ * rearrange the outline around it.
328
341
  */
329
342
  insertBlock(text: string, options?: {
330
343
  focus?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsoftwareltd/etherpk-extension-api",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "license": "MIT",
5
5
  "description": "The API an EtherPK extension is written against: the context it is started with, its manifest, and the contract its Views follow.",
6
6
  "type": "module",