|
66 | 66 | <link rel="stylesheet"
|
67 | 67 | href="plugins/step/intranda_step_transcription/css/style.css"></link>
|
68 | 68 |
|
69 |
| - |
70 | 69 | <script src="#{HelperForm.applicationWebsiteUrl}/uii/template/js/reactiveX/rx.lite.min.js"></script>
|
71 | 70 | <script src="#{HelperForm.applicationWebsiteUrl}/uii/template/js/q-promises/q.min.js"></script>
|
72 | 71 |
|
73 | 72 | <script src="#{HelperForm.applicationWebsiteUrl}/uii/template/js/openseadragon/openseadragon.min.js"></script>
|
74 | 73 | <script src="#{HelperForm.applicationWebsiteUrl}/uii/template/js/openseadragon/openseadragon-viewerinputhook.js"></script>
|
75 | 74 | <script src="#{HelperForm.applicationWebsiteUrl}/uii/template/js/imageView.min.js"></script>
|
| 75 | + <link href="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.snow.css" rel="stylesheet" /> |
| 76 | + <script src="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.js"></script> |
76 | 77 |
|
77 |
| - <script |
78 |
| - src="plugins/step/intranda_step_transcription/tinymce/tinymce.min.js"></script> |
79 | 78 |
|
80 | 79 | <section:section type="neutral">
|
81 | 80 | <section:header
|
|
94 | 93 | </h:commandLink>
|
95 | 94 | <h:commandLink
|
96 | 95 | id="id10a"
|
97 |
| - onclick="save()" |
98 | 96 | action="#{AktuelleSchritteForm.myPlugin.saveOcr}"
|
99 | 97 | title="#{msgs.save}"
|
100 | 98 | styleClass="btn d-flex align-items-center btn--title-action"
|
101 | 99 | pt:data-bs-toggle="tooltip">
|
102 |
| - <f:ajax execute="hiddenInputs" render="" /> |
| 100 | + <f:ajax execute="hiddenInputs" render=":myform" /> |
103 | 101 | <span
|
104 | 102 | aria-hidden="true"
|
105 | 103 | class="fa fa-save" />
|
|
171 | 169 | </div>
|
172 | 170 | </div>
|
173 | 171 | <div class="col-md-6 transcription-editor-col">
|
174 |
| - <textarea class="ocr-text" id="textarea_0"> |
| 172 | + <textarea class="ocr-text visually-hidden" id="textarea_0"> |
175 | 173 | #{AktuelleSchritteForm.myPlugin.image.ocrText}
|
176 | 174 | </textarea>
|
| 175 | + <div id="editor"> |
| 176 | + </div> |
177 | 177 | </div>
|
178 | 178 | </div>
|
179 | 179 | <!-- </ui:repeat> -->
|
|
215 | 215 | <!-- Save -->
|
216 | 216 | <h:commandLink
|
217 | 217 | styleClass="btn btn-blank"
|
218 |
| - id="save" onclick="save()" |
| 218 | + id="save" |
219 | 219 | action="#{AktuelleSchritteForm.myPlugin.saveOcr}">
|
220 | 220 | <span
|
221 | 221 | aria-hidden="true"
|
222 | 222 | class="fa fa-save" />
|
223 | 223 | <span>
|
224 | 224 | <h:outputText value="#{msgs.save}" />
|
225 | 225 | </span>
|
226 |
| - <f:setPropertyActionListener |
227 |
| - target="#{NavigationForm.uiStatus.pluginSimulation}" |
228 |
| - value="#{false}" /> |
229 |
| - <f:ajax execute="hiddenInputs" render="" /> |
| 226 | + <f:ajax execute="hiddenInputs" /> |
230 | 227 | </h:commandLink>
|
231 | 228 | <!-- Save and finish the task -->
|
232 | 229 | <h:commandLink
|
|
298 | 295 | });
|
299 | 296 | };
|
300 | 297 |
|
301 |
| - const initTinyMCE = () => { |
302 |
| - let mytiny = tinymce.init({ |
303 |
| - plugins: 'table', |
304 |
| - selector : '.ocr-text', |
305 |
| - menubar : '', |
306 |
| - toolbar: 'undo redo | formatselect | fontsizeselect | bold italic underline strikethrough | alignleft aligncenter alignright alighnblock | indent outdent | table | pastetext | forecolor backcolor', |
307 |
| - paste_as_text: true, |
308 |
| - height : "90vh", |
309 |
| - license_key: 'gpl', |
310 |
| - promotion: false, |
311 |
| - init_instance_callback: function (editor) { |
312 |
| - editor.on('blur', function (e) { |
313 |
| - save(); |
314 |
| - }); |
315 |
| - } |
316 |
| - |
| 298 | + const initQuill = () => { |
| 299 | + let quill = new Quill('#editor', { |
| 300 | + modules: { |
| 301 | + history: { |
| 302 | + delay: 2000, |
| 303 | + userOnly: true, |
| 304 | + }, |
| 305 | + toolbar: true, |
| 306 | + }, |
| 307 | + theme: 'snow', |
| 308 | + }); |
| 309 | + const content = document.querySelector('.ocr-text').value; |
| 310 | + quill.clipboard.dangerouslyPasteHTML(content); |
| 311 | + quill.on('text-change', function(delta, oldDelta, source) { |
| 312 | + const updatedContent = quill.getSemanticHTML(); |
| 313 | + const inputEl = document.querySelector('.input_0'); |
| 314 | + inputEl.value = updatedContent; |
| 315 | + const textArea = document.querySelector('.ocr-text'); |
| 316 | + textArea.value = updatedContent; |
317 | 317 | });
|
318 |
| - mytiny.then(mt => { |
319 |
| - console.log(mt) |
320 |
| - }) |
321 | 318 | };
|
322 | 319 |
|
323 | 320 | document.addEventListener('DOMContentLoaded', function() {
|
324 | 321 | showImage();
|
325 |
| - initTinyMCE(); |
| 322 | + initQuill(); |
326 | 323 | });
|
327 | 324 |
|
328 | 325 | // initialize image viewer and tinyMCE after ajax request
|
329 | 326 | jsf.ajax.addOnEvent(function (data) {
|
330 | 327 | if (data.status === 'success') {
|
331 | 328 | showImage();
|
332 |
| - initTinyMCE(); |
| 329 | + initQuill(); |
333 | 330 | }
|
334 | 331 | });
|
335 | 332 | </script>
|
|
0 commit comments