Skip to content

Commit b87c34e

Browse files
committed
DOC-3147: Add suggestededits to full-feature demo.
1 parent 79eb9b5 commit b87c34e

File tree

4 files changed

+465
-17
lines changed

4 files changed

+465
-17
lines changed

antora.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ asciidoc:
88
idseparator: '-@'
99
# generic variables
1010
companyurl: https://www.tiny.cloud
11-
cdnurl: https://cdn.tiny.cloud/1/no-api-key/tinymce/7/tinymce.min.js
12-
tdcdnurl: https://cdn.tiny.cloud/1/_your_api_key_/tinydrive/7/tinydrive.min.js
13-
tinymce_live_demo_url: https://cdn.tiny.cloud/1/qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc/tinymce/7/tinymce.min.js
14-
tinydrive_live_demo_url: https://cdn.tiny.cloud/1/qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc/tinydrive/7/tinydrive.min.js
11+
cdnurl: https://cdn.tiny.cloud/1/no-api-key/tinymce/8-testing/tinymce.min.js
12+
tdcdnurl: https://cdn.tiny.cloud/1/_your_api_key_/tinydrive/8-testing/tinydrive.min.js
13+
tinymce_live_demo_url: https://cdn.tiny.cloud/1/qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc/tinymce/8-testing/tinymce.min.js
14+
tinydrive_live_demo_url: https://cdn.tiny.cloud/1/qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc/tinydrive/8-testing/tinydrive.min.js
1515
webcomponent_url: https://cdn.jsdelivr.net/npm/@tinymce/tinymce-webcomponent/dist/tinymce-webcomponent.min.js
1616
jquery_url: https://cdn.jsdelivr.net/npm/@tinymce/tinymce-jquery@2/dist/tinymce-jquery.min.js
1717
openai_proxy_url: https://openai.ai-demo-proxy.tiny.cloud/v1/chat/completions

modules/ROOT/examples/live-demos/full-featured/example.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ const openai_api_key = "<INSERT_OPENAI_API_KEY_HERE>";
88

99
const isSmallScreen = window.matchMedia('(max-width: 1023.5px)').matches;
1010

11+
const tinymceElement = document.querySelector('textarea#full-featured');
12+
const model = tinymceElement.getAttribute('suggestededits-model');
13+
1114
tinymce.init({
1215
selector: 'textarea#full-featured',
13-
plugins: 'importword exportword exportpdf ai preview powerpaste casechange importcss tinydrive searchreplace autolink autosave save directionality advcode visualblocks visualchars fullscreen image link math media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker a11ychecker editimage help formatpainter permanentpen pageembed charmap tinycomments mentions quickbars linkchecker emoticons advtable footnotes mergetags autocorrect typography advtemplate markdown revisionhistory',
16+
plugins: 'importword exportword exportpdf ai suggestededits preview powerpaste casechange importcss tinydrive searchreplace autolink autosave save directionality advcode visualblocks visualchars fullscreen image link math media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker a11ychecker editimage help formatpainter permanentpen pageembed charmap tinycomments mentions quickbars linkchecker emoticons advtable footnotes mergetags autocorrect typography advtemplate markdown revisionhistory',
1417
tinydrive_token_provider: 'URL_TO_YOUR_TOKEN_PROVIDER',
1518
tinydrive_dropbox_app_key: 'YOUR_DROPBOX_APP_KEY',
1619
tinydrive_google_drive_key: 'YOUR_GOOGLE_DRIVE_KEY',
1720
tinydrive_google_drive_client_id: 'YOUR_GOOGLE_DRIVE_CLIENT_ID',
1821
mobile: {
19-
plugins: 'ai preview powerpaste casechange importcss tinydrive searchreplace autolink autosave save directionality advcode visualblocks visualchars fullscreen image link math media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker a11ychecker help formatpainter pageembed charmap mentions quickbars linkchecker emoticons advtable footnotes mergetags autocorrect typography advtemplate',
22+
plugins: 'ai suggestededits preview powerpaste casechange importcss tinydrive searchreplace autolink autosave save directionality advcode visualblocks visualchars fullscreen image link math media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker a11ychecker help formatpainter pageembed charmap mentions quickbars linkchecker emoticons advtable footnotes mergetags autocorrect typography advtemplate',
2023
},
2124
menu: {
2225
tc: {
@@ -25,7 +28,7 @@ tinymce.init({
2528
}
2629
},
2730
menubar: 'file edit view insert format tools table tc help',
28-
toolbar: "undo redo | importword exportword exportpdf | revisionhistory | aidialog aishortcuts | blocks fontsizeinput | bold italic | align numlist bullist | link image | table math media pageembed | lineheight outdent indent | strikethrough forecolor backcolor formatpainter removeformat | charmap emoticons checklist | code fullscreen preview | save print | pagebreak anchor codesample footnotes mergetags | addtemplate inserttemplate | addcomment showcomments | ltr rtl casechange | spellcheckdialog a11ycheck", // Note: if a toolbar item requires a plugin, the item will not present in the toolbar if the plugin is not also loaded.
31+
toolbar: "undo redo | importword exportword exportpdf | suggestededits | revisionhistory | aidialog aishortcuts | blocks fontsizeinput | bold italic | align numlist bullist | link image | table math media pageembed | lineheight outdent indent | strikethrough forecolor backcolor formatpainter removeformat | charmap emoticons checklist | code fullscreen preview | save print | pagebreak anchor codesample footnotes mergetags | addtemplate inserttemplate | addcomment showcomments | ltr rtl casechange | spellcheckdialog a11ycheck", // Note: if a toolbar item requires a plugin, the item will not present in the toolbar if the plugin is not also loaded.
2932
autosave_ask_before_unload: true,
3033
autosave_interval: '30s',
3134
autosave_prefix: '{path}{query}-{id}-',
@@ -439,4 +442,16 @@ tinymce.init({
439442
mentions_menu_complete: mentions_menu_complete, // TODO: Implement mentions_menu_complete
440443
mentions_select: mentions_select, // TODO: Implement mentions_select
441444
mentions_item_type: "profile",
445+
446+
// Suggested edits plugin settings
447+
user_id: 'kalebwilson',
448+
fetch_users: (userIds) => Promise.all(userIds
449+
.map((userId) =>
450+
fetch(`/users/${userId}`) // Fetch user data from the server
451+
.then((response) => response.json())
452+
.catch(() => ({ id: userId })) // Still return a valid user object even if the fetch fails
453+
)),
454+
suggestededits_model: model,
455+
suggestededits_access: 'full',
456+
suggestededits_content: 'html'
442457
});

0 commit comments

Comments
 (0)