Skip to content

Check API via AI agent#29

Open
serhiipylypchuk1991 wants to merge 8 commits intotestfrom
sp-test-check-api
Open

Check API via AI agent#29
serhiipylypchuk1991 wants to merge 8 commits intotestfrom
sp-test-check-api

Conversation

@serhiipylypchuk1991
Copy link
Contributor

No description provided.

@serhiipylypchuk1991 serhiipylypchuk1991 self-assigned this Mar 26, 2026
@@ -0,0 +1,42 @@
---
sidebar_label: theme
title: theme Config

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this information is kind of pointless for now, since we only support one theme for the JS wrapper (Material). this may become useful if/when we introduce more themes (like Material Dark, if this ever happens), and there's actually a choice, but right now it's just misleading

i don't really care if this stays in or not (as a placeholder), but at least mention that only one theme is supported at the moment, and do not provide examples that use non-existent themes (like "dark")


~~~jsx {}
toolbar?: boolean | Array<string | { id: string, type: string, label?: string, tooltip?: string, css?: string, handler?: () => any }>;
toolbar?: boolean | Array<string | { type: "button"; id?: string; icon?: string; label?: string; tooltip?: string; css?: string; handler?: () => void }>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not exactly correct - this assumes that the object can only specify custom buttons. in actuality we may also define button/richselect/colorpicker types for pre-existing buttons. if you want to include the actual types, include the full union -> https://git.webix.io/XBS/richtext/src/branch/master/js/src/types.index.ts#L34-L49

- `url` - a base URL for file export
- `download` - allows a user to specify if he wants to download the file after receiving the response back from the server. If the property is set to "false", the file will not download, but the user will instead be able to get blob data from the event object (see the `result` prop in the event definition)
- `fileName` - a file name to be exported
- `options` - an object with export options:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, we should also correct the example below to:

editor.api.exec("export", {
  options: {
      format: "pdf",
      download: false,
      fileName: "some file"
  }
});


### Parameters

The callback of the **insert-image** event receives an `IImageContext` object with the following parameters:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the description is fine here, but i'll probably just remove the irrelevant props from the types later on (name, file, status, selected, uploaded). fine for now, but will most likely get changed later


- `event` - (required) an event to be fired
- `config` - (required) the config object with parameters (see the event to be fired)
- `config` - (optional) the config object with parameters (see the event to be fired); omit for parameterless actions (e.g. `"undo"`, `"redo"`, `"print"`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not exactly, the config param is technically not optional, so it's still expected that we call

api.exec("undo", {});

and not

api.exec("undo");

though, in reality, there's little difference. but if we go by the typings, this is the expected input

event: string,
handler: function
handler: function,
options?: { tag?: string }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config?: { tag?: number | string | symbol; } if we go by real types

Initialize RichText with the `richtext.Richtext` constructor. The constructor takes two parameters:

- an HTML container (the ID of the HTML container)
- an HTML container — either a string with the ID of the HTML container or an `HTMLElement` object

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if set as a string, it can basically be any CSS selector string. the point is that is must return a single target element


```js
new richtext.Richtext("#root", {
theme: { name: "dark", fonts: true }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


## Available types

The following TypeScript types and interfaces are exported from the package:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this list looks kind of random

we don't actually export types explicitly (meaning they cannot be imported), so this entire section doesn't really apply. while TS is supported in general (everything is typed via d.ts files), types cannot be imported like that. all the exports are here: https://git.webix.io/XBS/richtext/src/branch/master/js/src/index.ts, and there are no types exported explicitly. this may change in the future (if needed), but this is not relevant for now

d.ts files are generated based on this input: https://git.webix.io/XBS/richtext/src/branch/master/js/src/types.index.ts (exported types and their dependencies are included in d.ts files)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants