Skip to content

Commit 24072fe

Browse files
authored
Feature/5/TINY-8595: UI components (#2333)
1 parent afd7d71 commit 24072fe

20 files changed

+234
-188
lines changed

modules/ROOT/pages/advanced/keyboard-shortcuts.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ NOTE: Browsers and Screen Readers provide additional shortcuts within the editor
205205

206206
include::partial$misc/advcode-shortcuts.adoc[]
207207

208+
[[addcustomshortcutstotinymce]]
208209
== Add custom shortcuts to TinyMCE
209210

210211
IMPORTANT: Adding a custom shortcut with a keyboard combination that conflicts with an existing {productname} or browser shortcut will override the existing shortcut.

modules/ROOT/pages/ui-components/autocompleter.adoc

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,21 @@ The two arguments this method take are:
6161
| highlight
6262
| array
6363
| Optional
64-
| When using <<cardmenuitem,CardMenuItems>>, use the highlight option to specify which <<cardtext,CardText>> items to highlight the matched text pattern on.
64+
| When using xref:cardmenuitem[CardMenuItems], use the highlight option to specify which xref:cardtext[CardText] items to highlight the matched text pattern on.
6565
|===
6666

6767
NOTE: If two or more autocompleters use the same trigger character, then the fetched results will be merged together before being displayed.
6868

6969
=== Usage of fetch
7070

71-
The `fetch` function is called when the trigger `char` is pressed and the `matches` predicate returns `true`. The `fetch` function is passed the matched text pattern and returns a https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise[Promise] containing matching results, specified as either <<autocompleteitem,AutocompleteItems>> or <<cardmenuitem,CardMenuItems>>. This allows for asynchronous fetching of the items. The `fetchOptions` parameter passed to the `fetch` function is by default an empty object, however using the <<api,reload>> API, additional options can be passed to fetch a different set of results.
71+
The `fetch` function is called when the trigger `char` is pressed and the `matches` predicate returns `true`. The `fetch` function is passed the matched text pattern and returns a https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise[Promise] containing matching results, specified as either xref:autocompleteitem[AutocompleteItems] or xref:cardmenuitem[CardMenuItems]. This allows for asynchronous fetching of the items. The `fetchOptions` parameter passed to the `fetch` function is by default an empty object, however using the xref:api[reload] API, additional options can be passed to fetch a different set of results.
7272

7373
There are two types of items:
7474

75-
* <<autocompleteitem,AutocompleteItem>>
76-
* <<cardmenuitem,CardMenuItem>>
75+
* xref:autocompleteitem[AutocompleteItem]
76+
* xref:cardmenuitem[CardMenuItem]
7777

78+
[[autocompleteitem]]
7879
==== AutocompleteItem
7980

8081
This is the standard item for the autocompleter. If no type is specified, autocompleter items are assumed to be of type `AutocompleteItem`.
@@ -95,7 +96,7 @@ This is the standard item for the autocompleter. If no type is specified, autoco
9596
| icon
9697
| string
9798
| optional
98-
| Name of the icon to be displayed. Must be a either single unicode character or an icon from: the link:{baseurl}/advanced/editor-icon-identifiers/[icon pack], a link:{baseurl}/advanced/creating-an-icon-pack/[custom icon pack], or an icon added using the xref:apis/tinymce.editor.ui.registry.adoc#addIcon[`addIcon` API].
99+
| Name of the icon to be displayed. Must be a either single unicode character or an icon from: the xref:advanced/editor-icon-identifiers.adoc[icon pack], a xref:advanced/creating-an-icon-pack.adoc[custom icon pack], or an icon added using the xref:apis/tinymce.editor.ui.registry.adoc#addIcon[`addIcon` API].
99100
|===
100101

101102
[source, js]
@@ -121,7 +122,7 @@ The `CardMenuItem` allows customization of layout and content. This is done by c
121122
| items
122123
| array
123124
| required
124-
| An array of <<carditems,CardItems>>
125+
| An array of xref:carditems[CardItems]
125126

126127
| value
127128
| string
@@ -144,15 +145,18 @@ The `CardMenuItem` allows customization of layout and content. This is done by c
144145
}
145146
----
146147

148+
[[carditems]]
147149
==== CardItems
148150

149151
`CardItems` are subcomponents for the `CardMenuItem`. Use these to construct your custom item and display relevant information to the user.
150152

151153
There are three types of card items:
152-
* <<cardcontainer,CardContainer>>
153-
* <<cardtext,CardText>>
154-
* <<cardimage,CardImage>>
155154

155+
* xref:cardcontainer[CardContainer]
156+
* xref:cardtext[CardText]
157+
* xref:cardimage[CardImage]
158+
159+
[[cardcontainer]]
156160
===== CardContainer
157161

158162
A `CardContainer` is a layout component used to apply a layout to an array of card items.
@@ -163,7 +167,7 @@ A `CardContainer` is a layout component used to apply a layout to an array of ca
163167
| items
164168
| array
165169
| required
166-
| An array of <<carditem,CardItems>>
170+
| An array of xref:carditems[CardItems]
167171

168172
| direction
169173
| `'vertical'` or `'horizontal'`
@@ -192,6 +196,7 @@ A `CardContainer` is a layout component used to apply a layout to an array of ca
192196
}
193197
----
194198

199+
[[cardtext]]
195200
===== CardText
196201

197202
`CardText` is a component for displaying text.
@@ -225,6 +230,7 @@ A `CardContainer` is a layout component used to apply a layout to an array of ca
225230
}
226231
----
227232

233+
[[cardimage]]
228234
===== CardImage
229235

230236
`CardImage` is a component for displaying an image.
@@ -258,6 +264,7 @@ A `CardContainer` is a layout component used to apply a layout to an array of ca
258264
}
259265
----
260266

267+
[[api]]
261268
== API
262269

263270
|===
@@ -284,6 +291,6 @@ liveDemo::autocompleter-autocompleteitem[height="300" tab="js" ]
284291

285292
=== Example: Using `CardMenuItems` in the Autocompleter
286293

287-
This example uses <<cardmenuitem,CardMenuItems>> and will show when a user types a hyphen (`-`) character and at least one additional character.
294+
This example uses xref:cardmenuitem[CardMenuItems] and will show when a user types a hyphen (`-`) character and at least one additional character.
288295

289296
liveDemo::autocompleter-cardmenuitem[height="300" tab="js" ]

modules/ROOT/pages/ui-components/contextmenu.adoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:keywords: contextmenu context menu contextmenuapi
44
:title_nav: Context menu
55

6-
The context menu is a configurable component that appears when the user right clicks in the editable area. By default it does not disable the operating system's native context menu, if there are no items to display at the cursor position the native context menu will be shown.
6+
The context menu is a configurable component that appears when the user right clicks in the editable area. By default, it does not disable the operating system's native context menu, if there are no items to display at the cursor position the native context menu will be shown.
77

88
The context menu supports both individual menu items and dynamic context menu sections.
99

@@ -73,19 +73,20 @@ When creating a dynamic menu, the structure `type` properties are used in order
7373
* type `separator` ignores all other properties.
7474

7575
////
76-
- ## Example Usage
76+
=== Example Usage
7777
7878
This example creates a menu with a mixture of dynamic and static menu items. While `link` is the name of both a context menu section and a menu item, context menu sections take preference (the link context menu is dynamic based on the cursor position).
7979
8080
The other item names are all menu items and will appear on the context menu regardless of cursor position. A separator is used to distinguish the table edit features from the table insert feature. As `link` is a context menu section, a separator will automatically be inserted after it so it is not necessary to specify one in the configuration.
8181
82-
```js
82+
[source, js]
83+
----
8384
tinymce.init({
8485
selector: 'textarea',
8586
contextmenu: 'link bold italic inserttable | cell row column deletetable'
8687
});
87-
```
88-
-
88+
----
89+
8990
////
9091

9192
== Defining a context menu section

modules/ROOT/pages/ui-components/contexttoolbar.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:keywords: contexttoolbar context toolbar contexttoolbarapi
44
:title_nav: Context toolbar
55

6-
A context toolbar can only contain either buttons that are defined for a normal toolbar, or buttons specifically registered for launching a link:{baseurl}/ui-components/contextform/[ContextForm]. The buttons comes as a list of strings, where each string is a registered name of a button.
6+
A context toolbar can only contain either buttons that are defined for a normal toolbar, or buttons specifically registered for launching a xref:ui-components/contextform.adoc[ContextForm]. The buttons come as a list of strings, where each string is a registered name of a button.
77

88
== Registering a context toolbar
99

modules/ROOT/pages/ui-components/customsidebar.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The sidebar API allows developers to add sidebars on editor instances in a simil
1212

1313
This is the syntax for the addSidebar function: `editor.ui.registry.addSidebar(name:String, spec:Object)`
1414

15-
When a new sidebar is registered, a corresponding toolbar button for toggling the sidebar open and close is also created using the same name. This button can then be included in the toolbar by adding the sidebar name to the link:{baseurl}/configure/editor-appearance/#toolbar/[`toolbar`] option.
15+
When a new sidebar is registered, a corresponding toolbar button for toggling the sidebar open and close is also created using the same name. This button can then be included in the toolbar by adding the sidebar name to the xref:configure/editor-appearance.adoc#toolbar[`toolbar`] option.
1616

1717
=== Specification object
1818

@@ -24,7 +24,7 @@ The `tooltip` specifies a tooltip to be displayed when hovering over the sidebar
2424

2525
==== `icon`
2626

27-
The `icon` specifies an icon for the sidebar toggle button. The icon should be the name of an icon provided by the {productname} skin or a xref:apis/tinymce.editor.ui.registry.adoc#addIcon/[custom icon].
27+
The `icon` specifies an icon for the sidebar toggle button. The icon should be the name of an icon provided by the {productname} skin or a xref:apis/tinymce.editor.ui.registry.adoc#addIcon[custom icon].
2828

2929
*Type*: `String`
3030

0 commit comments

Comments
 (0)