Browse Source

Rearrange advtemplate_list docs to make the example clearer (#3295)

pull/3307/head
Andrew Herron 1 year ago
committed by GitHub
parent
commit
0be9991015
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 52
      modules/ROOT/partials/configuration/advtemplate_list.adoc

52
modules/ROOT/partials/configuration/advtemplate_list.adoc

@ -10,7 +10,32 @@ None
*Return data:* `+Array+`
=== Example of `advtemplate_list` response
=== Example: using `advtemplate_list`
[source,js]
----
tinymce.init({
selector: 'textarea#advtemplate', // change this value according to your html
plugins: ["advtemplate"],
advtemplate_list: () =>
fetch('/categories', {
method: 'GET',
})
.then((response) => response.json())
.then((data) => data)
.catch((error) => console.log('Failed to get template list\n' + error)),
});
----
The data returned by `advtemplate_list` must adhere to the following requirements:
. Each list item must have a unique `id` value.
. Each list item must have a non-empty `title` value.
. Each category item is required to include an `items` sublist, which can be empty.
. Category items must not contain nested subcategories.
. Template item is not required to include a `content` value.
=== Sample `advtemplate_list` response
[source,js]
----
@ -33,28 +58,3 @@ None
}
]
----
The data returned by `advtemplate_list` must adhere to the following requirements:
. Each list item must have a unique `id` value.
. Each list item must have a non-empty `title` value.
. Each category item is required to include an `items` sublist, which can be empty.
. Category items must not contain nested subcategories.
. Template item is not required to include a `content` value.
=== Example: using `advtemplate_list`
[source,js]
----
tinymce.init({
selector: 'textarea#advtemplate', // change this value according to your html
plugins: ["advtemplate"],
advtemplate_list: () =>
fetch('/categories', {
method: 'GET',
})
.then((response) => response.json())
.then((data) => data)
.catch((error) => console.log('Failed to get template list\n' + error)),
});
----
Loading…
Cancel
Save