|
224 | 224 | <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-convert">convert</a></span></span></li> |
225 | 225 | <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-exportContent">exportContent</a></span></span></li> |
226 | 226 | <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getInfo">getInfo</a></span></span></li> |
227 | | -<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-importContent">importContent</a></span></span></li> |
| 227 | +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-import_">import_</a></span></span></li> |
228 | 228 | <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-init">init</a></span></span></li> |
229 | 229 | <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-newContentPart">newContentPart</a></span></span></li> |
230 | 230 | <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-openContentPart">openContentPart</a></span></span></li> |
|
288 | 288 | </nav> |
289 | 289 |
|
290 | 290 | <div class="content" data-ice="content"><h1 data-ice="title">src/Editor.js</h1> |
291 | | -<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import { editorLogger as logger } from './configuration/LoggerConfig'; |
| 291 | +<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">/* eslint-disable no-underscore-dangle */ |
| 292 | +import { editorLogger as logger } from './configuration/LoggerConfig'; |
292 | 293 | import * as DefaultBehaviors from './configuration/DefaultBehaviors'; |
293 | 294 | import * as DefaultConfiguration from './configuration/DefaultConfiguration'; |
294 | 295 | import * as DefaultStyles from './configuration/DefaultPenStyle'; |
|
555 | 556 | * Launch the import. |
556 | 557 | * @param {Editor} editor |
557 | 558 | * @param {Model} model |
558 | | - * @param {{x: Number, y: Number}} point Insert point coordinates |
559 | 559 | * @param {Blob} data |
560 | 560 | */ |
561 | | -function launchImport(editor, model, point, data) { |
562 | | - if (editor.recognizer && editor.recognizer.importContent) { |
| 561 | +function launchImport(editor, model, data) { |
| 562 | + if (editor.recognizer && editor.recognizer.import_) { |
563 | 563 | editor.recognizerContext.initPromise |
564 | 564 | .then(() => { |
565 | | - editor.recognizer.importContent(editor.recognizerContext, model, point, data, (err, res, ...types) => { |
| 565 | + editor.recognizer.import_(editor.recognizerContext, model, data, (err, res, ...types) => { |
566 | 566 | recognizerCallback(editor, err, res, ...types); |
567 | 567 | }); |
568 | 568 | }); |
|
573 | 573 | * Launch the convert with all editor relative configuration and state. |
574 | 574 | * @param {Editor} editor |
575 | 575 | * @param {Model} model |
| 576 | + * @param {String} conversionState |
576 | 577 | */ |
577 | | -function launchConvert(editor, model) { |
| 578 | +function launchConvert(editor, model, conversionState) { |
578 | 579 | if (editor.recognizer && editor.recognizer.convert) { |
579 | 580 | editor.recognizerContext.initPromise |
580 | 581 | .then(() => { |
581 | 582 | editor.recognizer.convert(editor.recognizerContext, model, (err, res, ...types) => { |
582 | 583 | recognizerCallback(editor, err, res, ...types); |
583 | | - }); |
| 584 | + }, conversionState); |
584 | 585 | }); |
585 | 586 | } |
586 | 587 | } |
|
1142 | 1143 | /** |
1143 | 1144 | * Convert the current content |
1144 | 1145 | */ |
1145 | | - convert() { |
| 1146 | + convert(conversionState = 'DIGITAL_EDIT') { |
1146 | 1147 | if (this.canConvert) { |
1147 | 1148 | triggerCallbacks(this, undefined, Constants.EventType.CONVERT); |
1148 | | - launchConvert(this, this.model); |
| 1149 | + launchConvert(this, this.model, conversionState); |
1149 | 1150 | } |
1150 | 1151 | } |
1151 | 1152 |
|
|
1170 | 1171 |
|
1171 | 1172 | /** |
1172 | 1173 | * Import content. |
1173 | | - * @param {{x: Number, y: Number}} point Insert point coordinates |
1174 | 1174 | * @param {Blob|*} data Data to import |
1175 | 1175 | * @param {String} [mimetype] Mimetype of the data, needed if data is not a Blob |
1176 | 1176 | */ |
1177 | | - importContent(point, data, mimetype) { |
| 1177 | + import_(data, mimetype) { |
1178 | 1178 | triggerCallbacks(this, undefined, Constants.EventType.IMPORT); |
1179 | | - launchImport(this, this.model, point, !(data instanceof Blob) ? new Blob([data], { type: mimetype }) : data); |
| 1179 | + launchImport(this, this.model, !(data instanceof Blob) ? new Blob([data], { type: mimetype }) : data); |
1180 | 1180 | } |
1181 | 1181 |
|
1182 | 1182 | /** |
|
0 commit comments