diff --git a/docs/src/demos/Extensions/FontFamily/index.spec.js b/docs/src/demos/Extensions/FontFamily/index.spec.js
new file mode 100644
index 00000000..66cd612e
--- /dev/null
+++ b/docs/src/demos/Extensions/FontFamily/index.spec.js
@@ -0,0 +1,5 @@
+context('/api/extensions/font-family', () => {
+ before(() => {
+ cy.visit('/api/extensions/font-family')
+ })
+})
diff --git a/docs/src/demos/Extensions/FontFamily/index.vue b/docs/src/demos/Extensions/FontFamily/index.vue
new file mode 100644
index 00000000..a76515b3
--- /dev/null
+++ b/docs/src/demos/Extensions/FontFamily/index.vue
@@ -0,0 +1,69 @@
+
+
Inter
-Comic Sans
-serif
-monospace
-cursive
+This has a <span> tag without a style attribute, so it’s thrown away.
+But this one is wrapped in a <span> tag with an inline style attribute, so it’s kept - even if it’s empty for now.
`, }) }, diff --git a/docs/src/docPages/api/extensions/font-family.md b/docs/src/docPages/api/extensions/font-family.md index 08c86b2a..b5f19940 100644 --- a/docs/src/docPages/api/extensions/font-family.md +++ b/docs/src/docPages/api/extensions/font-family.md @@ -1,5 +1,5 @@ # FontFamily -This extension enables you to set the font family in the editor. +This extension enables you to set the font family in the editor. It uses the [`TextStyle`](/api/marks/text-style) mark, which renders a `` tag. The font family is applied as inline style, for example ``. ## Installation ::: warning Use with TextStyle @@ -15,9 +15,14 @@ yarn add @tiptap/extension-text-style @tiptap/extension-font-family ``` ## Settings -| Option | Type | Default | Description | -| ------ | ----- | ------------- | --------------------------------------------------------------------- | -| types | array | ['textStyle'] | A list of marks where the font family attribute should be applied to. | +| Option | Type | Default | Description | +| ------ | ----- | ------------- | ------------------------------------------------------------------------ | +| types | array | ['textStyle'] | A list of marks to which the font family attribute should be applied to. | + +## Commands +| Command | Parameters | Description | +| ---------- | ---------- | --------------------------------------------- | +| fontFamily | fontFamily | Applies the given font family as inline style | ## Source code [packages/extension-font-family/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-font-family/) diff --git a/docs/src/docPages/api/marks/text-style.md b/docs/src/docPages/api/marks/text-style.md index 0251ecd4..e620235a 100644 --- a/docs/src/docPages/api/marks/text-style.md +++ b/docs/src/docPages/api/marks/text-style.md @@ -10,6 +10,11 @@ npm install @tiptap/extension-text-style yarn add @tiptap/extension-text-style ``` +## Commands +| Command | Parameters | Description | +| -------------------- | ---------- | --------------------------------------------- | +| removeEmptyTextStyle | – | Remove `` tags without an inline style. | + ## Source code [packages/extension-text-style/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-text-style/) diff --git a/docs/src/docPages/guide/build-custom-extensions.md b/docs/src/docPages/guide/build-custom-extensions.md index b5d819cd..2a2c1ed4 100644 --- a/docs/src/docPages/guide/build-custom-extensions.md +++ b/docs/src/docPages/guide/build-custom-extensions.md @@ -354,6 +354,9 @@ const CustomLink = Link.extend({ ``` ## Start from scratch +You can also build your own extensions from scratch with the `createNode()`, `createMark()`, and `createExtension()` functions. Pass an option with your code and configuration. + +And if everything is working fine, don’t forget to [share it with the community](https://github.com/ueberdosis/tiptap-next/issues/new/choose). ### Create a node ```js diff --git a/docs/src/links.yaml b/docs/src/links.yaml index 8fa7a0a4..12aacccf 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -119,7 +119,6 @@ link: /api/marks/strike - title: TextStyle link: /api/marks/text-style - draft: true - title: Underline link: /api/marks/underline - title: Extensions @@ -137,7 +136,6 @@ link: /api/extensions/focus - title: FontFamily link: /api/extensions/font-family - draft: true - title: Gapcursor link: /api/extensions/gapcursor - title: History @@ -152,7 +150,6 @@ link: /api/events - title: Schema link: /api/schema - new: true - title: Keyboard Shortcuts link: /api/keyboard-shortcuts