Skip to content

Commit 36b424b

Browse files
author
Farzad Hayat
authored
DOC-2598: TINY-11459 Improve the context form placeholder sample code (#3563)
1 parent e738181 commit 36b424b

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

modules/ROOT/examples/live-demos/context-form/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ tinymce.init({
1818
},
1919
label: 'Link',
2020
predicate: isAnchorElement,
21+
placeholder: 'https://www.example.com',
2122
initValue: () => {
2223
const elm = getAnchorElement();
2324
return !!elm ? elm.href : '';

modules/ROOT/pages/7.6.0-release-notes.adoc

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ tinymce.init({
278278
});
279279
----
280280

281+
For more details on the `back` function, see xref:contextform.adoc#formapi[Context Form - ContextFormApi].
282+
281283
=== New `QuickbarInsertImage` command that is executed by the `quickimage` button.
282284
// #TINY-11399
283285

@@ -312,26 +314,30 @@ tinymce.init({
312314

313315
A new `+onSetup+` API has been introduced for context forms, enabling integrators to execute a function when the form is rendered and handle cleanup when it is closed. This enhancement addresses the previous limitation of not being able to detect or trigger actions during the lifecycle of context forms. The `+onSetup+` API streamlines lifecycle management by supporting initialization at form rendering and providing a return function for cleanup, enhancing integration with plugins and applications.
314316

315-
For more details, refer to xref:contextform.adoc#form[Context Form].
317+
For more details on the `+onSetup+` function, see xref:contextform.adoc#form[Context Form].
316318

317319
=== Added placeholder support for context form input fields
318320
// #TINY-11459
319321

320-
A new `placeholder` option has been introduced to the context form API, addressing the need for inline guidance within input fields. This feature enables developers to specify placeholder text that appears inside input fields until the field is focused or a value is entered. By providing contextual hints, this enhancement improves usability and enhances the user experience.
322+
A new `placeholder` option has been introduced to the context form API, addressing the need for inline guidance within input fields. This feature enables developers to specify placeholder text that appears inside input fields until the field has a value. By providing contextual hints, this enhancement improves usability and enhances the user experience.
321323

322324
.Example: Using a placeholder in a context form input field
323325
[source,js]
324326
----
325-
editor.ui.registry.addContextForm('upload-url', {
326-
launch: {
327-
type: 'contextformtogglebutton',
328-
icon: 'link',
329-
tooltip: 'Upload from URL'
327+
tinymce.init({
328+
selector: 'textarea',
329+
setup: (editor) => {
330+
editor.ui.registry.addContextForm('my-form', {
331+
predicate: () => true,
332+
placeholder: 'Placeholder goes here...',
333+
commands: []
334+
});
330335
},
331-
placeholder: 'Enter URL here...', ....
332336
});
333337
----
334338

339+
For more details on the `placeholder` option, see xref:contextform.adoc#form[Context Form].
340+
335341
=== New `+disabled+` option for disabling all user interactions
336342

337343
A new `+disabled+` option has been introduced to {productname} in version {release-version}. This option allows integrators to disable all user interactions with the editor, including cursor placement, content modifications, and UI components. When set to `+true+`, the editor behaves similarly to the readonly mode changes introduced in {productname} 7.4.0 but ensures complete non-interactivity.

modules/ROOT/pages/contextform.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This relates to the form itself. The form specifications are:
4141
|Name |Details
4242
|`+launch+` |This is the specification for the launching button that can appear in a context toolbar only. It will be either type: `+contextformbutton+` or `+contextformtogglebutton+`, and will be identical to those definitions below except it will *not* have an `+onAction+`.
4343
|`+label+` |This is the label that will appear in the form.
44+
|`+placeholder+` |This specifies placeholder text that appears inside the input field until the field has a value.
4445
|`+initValue+` |This is the initial value the input will have in the form.
4546
|`+predicate+` |This controls when the context toolbar will appear.
4647
|`+position+` |This controls where the context toolbar will appear with regards to the current cursor.

0 commit comments

Comments
 (0)