Skip to content

Commit

Permalink
update menu in for lookup table add options to create multiple rows/c…
Browse files Browse the repository at this point in the history
…olumns
  • Loading branch information
vasergen committed Jan 29, 2025
1 parent 293ef4d commit 8ab2272
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 11 deletions.
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# NOTE

This is a fork of the original repository with extended table menu functionality.
Added features:
- Add 5 rows after selection
- Add 5 rows before selection
- Add 5 columns after selection
- Add 5 columns before selection

To publish the package use `yarn build-publish`.
Our version numbering follows the format: `[original-version]-[our-modification]`
Example: Version `1.8.3-01` means:
- `1.8.3`: Original version
- `01`: Our modification number


# Flexible Editor for Directus

<!-- NOTE: [extension-description] Sync description with GitHub, custom-messages.ts and package.json -->
Expand All @@ -10,23 +26,23 @@ Under the hood, it integrates the [Tiptap](https://github.com/ueberdosis/tiptap)

## Features

:rocket: **Composable Blocks**: Compose blocks as you would with the built-in builder interface and insert these referenced items directly into Flexible Editor as a Relation Block.
:rocket: **Composable Blocks**: Compose blocks as you would with the built-in builder interface and insert these referenced items directly into Flexible Editor as a "Relation Block".

<details><summary>Show example</summary>

![](https://raw.githubusercontent.com/formfcw/directus-extension-flexible-editor/main/docs/feature-relation-blocks.gif)

</details>

:rocket: **Inline Blocks**: Use relation blocks inline by inserting them directly into the text flow as Relation Inline Blocks.
:rocket: **Inline Blocks**: Use relation blocks inline by inserting them directly into the text flow as "Relation Inline Blocks".

<details><summary>Show example</summary>

![](https://raw.githubusercontent.com/formfcw/directus-extension-flexible-editor/main/docs/feature-relation-inline-blocks.gif)

</details>

:rocket: **Internal Linking**: Create your own custom link collection(s) and apply it as Relation Mark to selected text within Flexible Editor.
:rocket: **Internal Linking**: Create your own custom link collection(s) and apply it as "Relation Mark" to selected text within Flexible Editor.

<details><summary>Show example</summary>

Expand All @@ -50,7 +66,7 @@ Under the hood, it integrates the [Tiptap](https://github.com/ueberdosis/tiptap)

</details>

:rocket: **Render Interactive Components**: On your front-end, you can render any node (especially Relation Nodes) with your own custom component using [Flexible Editor Content](https://github.com/formfcw/directus-extension-flexible-editor/tree/main/content).
:rocket: **Render Interactive Components**: On your front-end, you can render any node (especially "Relation Nodes") with your own custom component using [Flexible Editor Content](https://github.com/formfcw/directus-extension-flexible-editor/tree/main/content).

## Installation

Expand All @@ -76,7 +92,7 @@ Navigate to the interface tab to adjust the settings.
| M2A Reference Field<ul><li>Relation Blocks</li><li>Relation Inline Blocks</li><li>Relation Marks</li></ul> | Described in detail below _(Usage with relation nodes)_ |
| Placeholder | Display a placeholder text when empty |
| Tools | Select the editor tools you want to use |
| Toolbar | _Static_ … The toolbar appears at the top of the editor<br>_Sticky_ The toolbar stays at the top of the viewport as you scroll<br>_Floating_ … The toolbar floats above the current cursor position |
| Toolbar | _Static_ … The toolbar appears at the top of the editor<br>_Sticky_ The toolbar stays at the top of the viewport as you scroll<br>_Floating_ … The toolbar floats above the current cursor position |
| Formats Button Appearance | Display the active format name instead of just an icon |
| Input Mode | _Multi-line text_ … Default behavior<br>_Single-line text_ … Turns into an inline editor that only allows marks and inline blocks |
| Editor Height | _Grow till Overflow_ … The height grows with its content as long as it remains in the viewport<br>_Grow_ … The height grows with its content<br>_Fixed_ … The editor has a fixed height |
Expand Down Expand Up @@ -109,7 +125,7 @@ You can insert items from your Directus collections into Flexible Editor. This i

</details>

3. Enter a name for the field, such as `editor_nodes` and uncheck `Auto Fill` on the `Relationship` tab, so that you can manually select the junction collection you created earlier (such as `xxxx_editor_nodes`). Select the `Related Collections` you want to integrate into your Flexible Editor field. You dont need to set a `sort` field, but you do want to set the `Relational Triggers` to `cascade` when an item is deleted or deselected.
3. Enter a name for the field, such as `editor_nodes` and uncheck `Auto Fill` on the `Relationship` tab, so that you can manually select the junction collection you created earlier (such as `xxxx_editor_nodes`). Select the `Related Collections` you want to integrate into your Flexible Editor field. You don't need to set a `sort` field, but you do want to set the `Relational Triggers` to `cascade` when an item is deleted or deselected.

<details><summary>Show example</summary>

Expand Down Expand Up @@ -139,7 +155,7 @@ You can insert items from your Directus collections into Flexible Editor. This i

- **Relation Block** … A block, you can insert in Flexible Editor, that references an item of a collection you can compose yourself.
> Use Cases: gallery, video, related content, complex content structure, …
- **Relation Inline Block** … Same as Relation Block, but appears inside text.
- **Relation Inline Block** … Same as "Relation Block", but appears inside text.
> Use Cases: link to referenced item using item data for link text, inline image/icon, placeholders/variables for templates (e.g. email), …
- **Relation Mark** … A mark, you can apply to selected text, that references an item of a collection you can compose yourself.
> Use Cases: classic link (compose your own), link to referenced item, button that opens a modal/overlay/video, …
Expand All @@ -154,7 +170,7 @@ You can insert items from your Directus collections into Flexible Editor. This i

</details>

> **Tip**: If you set up Flexible Editor in the same way for different collections, you can copy and paste the duplication settings via `Copy Raw Value` from the field menu — by clicking on the Item Duplication Fields label.
> **Tip**: If you set up Flexible Editor in the same way for different collections, you can copy and paste the duplication settings via `Copy Raw Value` from the field menu — by clicking on the "Item Duplication Fields" label.
### Things to keep in mind

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "directus-extension-flexible-editor",
"version": "1.8.3",
"name": "@finanzchef24gmbh/directus-extension-flexible-editor",
"version": "1.8.3-01",
"description": "A rich text editor (WYSIWYG) with JSON output that allows the integration of M2A relations to make it extremely flexible.",
"license": "GPL-3.0",
"author": {
Expand Down
4 changes: 4 additions & 0 deletions src/interface/i18n/custom-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,14 @@ export default {
section_columns: "Column",
add_column_before: "Add column before",
add_column_after: "Add column after",
add_5_columns_before: "Add 5 columns before",
add_5_columns_after: "Add 5 columns after",
delete_column: "Delete column",
section_rows: "Row",
add_row_before: "Add row before",
add_row_after: "Add row after",
add_5_rows_before: "Add 5 rows before",
add_5_rows_after: "Add 5 rows after",
delete_row: "Delete row",
},
text_align: {
Expand Down
41 changes: 40 additions & 1 deletion src/interface/tools/table/ToolButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@
<v-text-overflow :text="t('table.add_column_before')" />
</v-list-item-content>
</v-list-item>

<v-list-item clickable @click="() => {
for (let i = 0; i < 5; i++) {
editor.chain().focus().addColumnBefore().run();
}
}" :disabled="!editor.can().chain().focus().addColumnBefore().run()">
<v-list-item-content>
<v-text-overflow :text="t('table.add_5_columns_before')" />
</v-list-item-content>
</v-list-item>

<v-list-item
clickable
@click="editor.chain().focus().addColumnAfter().run()"
Expand All @@ -76,6 +87,17 @@
<v-text-overflow :text="t('table.add_column_after')" />
</v-list-item-content>
</v-list-item>

<v-list-item clickable @click="() => {
for (let i = 0; i < 5; i++) {
editor.chain().focus().addColumnAfter().run();
}
}" :disabled="!editor.can().chain().focus().addColumnAfter().run()">
<v-list-item-content>
<v-text-overflow :text="t('table.add_5_columns_after')" />
</v-list-item-content>
</v-list-item>

<v-list-item
clickable
@click="editor.chain().focus().deleteColumn().run()"
Expand All @@ -93,7 +115,6 @@
<template #activator>
<v-text-overflow :text="t('table.section_rows')" />
</template>

<v-list-item
clickable
@click="editor.chain().focus().addRowBefore().run()"
Expand All @@ -103,6 +124,15 @@
<v-text-overflow :text="t('table.add_row_before')" />
</v-list-item-content>
</v-list-item>
<v-list-item clickable @click="() => {
for (let i = 0; i < 5; i++) {
editor.chain().focus().addRowBefore().run();
}
}" :disabled="!editor.can().chain().focus().addRowBefore().run()">
<v-list-item-content>
<v-text-overflow :text="t('table.add_5_rows_before')" />
</v-list-item-content>
</v-list-item>
<v-list-item
clickable
@click="editor.chain().focus().addRowAfter().run()"
Expand All @@ -112,6 +142,15 @@
<v-text-overflow :text="t('table.add_row_after')" />
</v-list-item-content>
</v-list-item>
<v-list-item clickable @click="() => {
for (let i = 0; i < 5; i++) {
editor.chain().focus().addRowAfter().run();
}
}" :disabled="!editor.can().chain().focus().addRowAfter().run()">
<v-list-item-content>
<v-text-overflow :text="t('table.add_5_rows_after')" />
</v-list-item-content>
</v-list-item>
<v-list-item
clickable
@click="editor.chain().focus().deleteRow().run()"
Expand Down

0 comments on commit 8ab2272

Please sign in to comment.