Skip to content

Commit

Permalink
[FIX] docs: use ts tag instead of js tag
Browse files Browse the repository at this point in the history
We sometime used the `js` tag in the docs, then proceeded to write
typescript.

This commit changes all the `js` tags to `ts` tags to stay consistent.

Task: 4276932
Part-of: #5115
Signed-off-by: Vincent Schippefilt (vsc) <[email protected]>
  • Loading branch information
hokolomopo committed Oct 22, 2024
1 parent c6c5506 commit f392c9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions doc/extending/command.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Core commands should be device-agnostic and include all necessary information to

To declare a new `CoreCommands`, its type should be added to `coreTypes`:

```js
```ts
import { coreTypes } from "@odoo/o-spreadsheet";

coreTypes.add("MY_COMMAND_NAME");
Expand All @@ -46,7 +46,7 @@ In read-only mode, all core commands are cancelled with the `CommandResult` `Rea
However, some locale commands still need to be executed, such as updating the active sheet.
To allow a new local command in read-only mode, add its type to `readonlyAllowedCommands`:

```js
```ts
import { readonlyAllowedCommands } from "@odoo/o-spreadsheet";

readonlyAllowedCommands.add("MY_COMMAND_NAME");
Expand All @@ -72,7 +72,7 @@ Some commands can be repeated with CTRL+Y (redo) when the redo stack is empty. T

To declare a repeatable core command, add it to the `repeatCommandTransformRegistry`

```js
```ts
import { repeatCommandTransformRegistry, genericRepeat } from "@odoo/o-spreadsheet";

repeatCommandTransformRegistry.add("MY_CORE_COMMAND", genericRepeat);
Expand Down Expand Up @@ -105,15 +105,15 @@ repeatCommandTransformRegistry.add("ADD_COL_ROW_COMMAND", repeatAddColumnsRowsCo

Local commands can also be repeated. To declare a repeatable local command, add it to the `repeatLocalCommandTransformRegistry`:

```js
```ts
import { repeatLocalCommandTransformRegistry, genericRepeat } from "@odoo/o-spreadsheet";

repeatLocalCommandTransformRegistry.add("MY_LOCAL_COMMAND", genericRepeat);
```

For local commands, the transformation function includes a third argument: the core (sub)commands dispatched during the handling of the root local command. This is useful if the result depends on the UI plugins' state, as there is no guarantee that the UI plugins' state will be the same when the command is repeated. Adapting the child core commands can be a valid way to adjust the local command, as they do not depend on any internal state.

```js
```ts
type LocalRepeatTransform = (
getters: Getters,
cmd: LocalCommand,
Expand Down
6 changes: 3 additions & 3 deletions doc/integrating/collaborative/collaborative.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ To extend o-spreadsheet without breaking realtime collaborative edition, there a
There are two types of [commands](add_command.md): `CoreCommands` and `Commands`. Only `CoreCommands` are synchronized.
Here is the way to register a `CoreCommand` to o-spreadsheet.

```js
```ts
const { coreTypes } = o_spreadsheet;

coreTypes.add("MY_COMMAND_NAME");
Expand All @@ -133,7 +133,7 @@ A transformation function takes as arguments the already executed command, and t

If a transformation is required, here is the way to declare it. The transformation check that the command is on the same sheet of the deleted sheet. If true, the command should be skipped.

```js
```ts
const { otRegistry } = o_spreadsheet.registries;

otRegistry.addTransformation("DELETE_SHEET", ["MY_COMMAND"], (myCommand, deleteSheet) => {
Expand Down Expand Up @@ -165,7 +165,7 @@ The inverse function is used during a selective undo to transform commands execu

Here is the way to declare it.

```js
```ts
const { inverseCommandRegistry } = o_spreadsheet.registries;

inverseCommandRegistry.add("CREATE_SHEET", (cmd) => {
Expand Down

0 comments on commit f392c9b

Please sign in to comment.