{"id":12689,"date":"2021-06-13T19:57:36","date_gmt":"2021-06-14T00:57:36","guid":{"rendered":"httpss:\/\/www.powenko.com\/wordpress\/docs\/tinymce\/plugins%e8%87%aa%e8%a3%bd\/%e8%bc%b8%e5%85%a5%e8%a8%8a%e6%81%afannotations\/"},"modified":"2021-06-13T19:59:41","modified_gmt":"2021-06-14T00:59:41","slug":"%e8%bc%b8%e5%85%a5%e8%a8%8a%e6%81%afannotations","status":"publish","type":"docs","link":"https:\/\/www.powenko.com\/wordpress\/?docs=tinymce\/plugins%e8%87%aa%e8%a3%bd\/%e8%bc%b8%e5%85%a5%e8%a8%8a%e6%81%afannotations","title":{"rendered":"\u8f38\u5165\u8a0a\u606fAnnotations"},"content":{"rendered":"<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html lang=&quot;en&quot;&gt;\r\n&lt;head&gt;\r\n    &lt;!--\r\n    &lt;script src=&quot;httpsss:\/\/cdn.tiny.cloud\/1\/mott8ilewgbu1tryzfu9q7sdcmn5qfqt19jixbvaqgaz6kjc\/tinymce\/5\/tinymce.min.js&quot; referrerpolicy=&quot;origin&quot;&gt;&lt;\/script&gt;\r\n    --&gt;\r\n    &lt;script src=&quot;httpsss:\/\/code.jquery.com\/jquery-1.11.3.js&quot;&gt;&lt;\/script&gt;\r\n    &lt;script src=&quot;..\/..\/..\/system\/libs\/tinymce\/js\/tinymce\/tinymce.min.js&quot; referrerpolicy=&quot;origin&quot;&gt;&lt;\/script&gt;\r\n\r\n    &lt;script&gt;\r\n\r\n\r\n        var settings = {\r\n            selector: 'textarea#richTextArea_ww_powenko_com',\r\n            toolbar: &#x5B;'annotate-alpha'],\r\n            menubar: false,\r\n            height: '750px',\r\n            content_style: '.mce-annotation { background-color: darkgreen; color: white; } ' + 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',\r\n\r\n            setup: function (editor) {\r\n                editor.ui.registry.addButton('annotate-alpha', {\r\n                    text: 'Annotate',\r\n                    onAction: function() {\r\n                        var comment = prompt('Comment with?');\r\n                        editor.annotator.annotate('alpha', {\r\n                            uid: 'custom-generated-id',\r\n                            comment: comment\r\n                        });\r\n                        editor.focus();\r\n                    },\r\n                    onSetup: function (btnApi) {\r\n                        editor.annotator.annotationChanged('alpha', function (state, name, obj) {\r\n                            console.log('Current selection has an annotation: ', state);\r\n                            btnApi.setDisabled(state);\r\n                        });\r\n                    }\r\n                });\r\n\r\n                editor.on('init', function () {\r\n                    editor.annotator.register('alpha', {\r\n                        persistent: true,\r\n                        decorate: function (uid, data) {\r\n                            return {\r\n                                attributes: {\r\n                                    'data-mce-comment': data.comment ? data.comment : '',\r\n                                    'data-mce-author': data.author ? data.author : 'anonymous'\r\n                                }\r\n                            };\r\n                        }\r\n                    });\r\n                });\r\n            }\r\n        };\r\n\r\n        tinymce.init(settings);\r\n\r\n\r\n\r\n\r\n\r\n\r\n    &lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;textarea id=&quot;richTextArea_ww_powenko_com&quot;&gt;\r\n\r\n  &lt;p&gt;Right click on the example image below will show the newly configured context menu.&lt;\/p&gt;\r\n\r\n  &lt;p&gt;Right Clicking on text should not invoke the context menu&lt;\/p&gt;\r\n&lt;\/textarea&gt;\r\nwww.powenko.com\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><iframe loading=\"lazy\" width=\"100%\" height=\"300\" src=\"\/\/jsfiddle.net\/powenko\/6sLfo0c5\/embedded\/\" allowfullscreen=\"allowfullscreen\" allowpaymentrequest frameborder=\"0\"><\/iframe><\/p>\n","protected":false},"featured_media":0,"parent":12682,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-12689","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/docs\/12689"}],"collection":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12689"}],"version-history":[{"count":2,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/docs\/12689\/revisions"}],"predecessor-version":[{"id":12691,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/docs\/12689\/revisions\/12691"}],"up":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/docs\/12682"}],"prev":[{"title":"\u81ea\u88fd\u5916\u639b-easy","link":"https:\/\/www.powenko.com\/wordpress\/?docs=tinymce\/plugins%e8%87%aa%e8%a3%bd\/%e8%87%aa%e8%a3%bd%e5%a4%96%e6%8e%9b-easy","href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/docs\/12683"}],"wp:attachment":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12689"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=12689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}