@@ -8,15 +8,18 @@ const openai_api_key = "<INSERT_OPENAI_API_KEY_HERE>";
88
99const 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+
1114tinymce . 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