Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit 82ed3ea

Browse files
committed
[DEV] Refactor importContent method to import_, remove point parameter
1 parent dc0b945 commit 82ed3ea

File tree

73 files changed

+47836
-48613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+47836
-48613
lines changed

dist/myscript.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/myscript.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/ast/source/Editor.js.json

Lines changed: 30536 additions & 30420 deletions
Large diffs are not rendered by default.

docs/ast/source/recognizer/DefaultRecognizer.js.json

Lines changed: 1066 additions & 1066 deletions
Large diffs are not rendered by default.

docs/ast/source/recognizer/websocket/v4/Cdkv4WSIInkRecognizer.js.json

Lines changed: 15777 additions & 16672 deletions
Large diffs are not rendered by default.

docs/class/src/Editor.js~Editor.html

Lines changed: 75 additions & 65 deletions
Large diffs are not rendered by default.

docs/coverage.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"expectCount": 56,
1313
"actualCount": 50,
1414
"undocumentLines": [
15-
409,
16-
404,
17-
488,
18-
438,
19-
589,
20-
590
15+
410,
16+
405,
17+
489,
18+
439,
19+
590,
20+
591
2121
]
2222
},
2323
"src/recognizer/websocket/v4/Cdkv4WSIInkRecognizer.js": {
@@ -29,9 +29,9 @@
2929
80,
3030
89,
3131
68,
32-
209,
33-
216,
34-
223
32+
204,
33+
211,
34+
218
3535
]
3636
},
3737
"src/renderer/canvas/symbols/MathSymbolCanvasRenderer.js": {

docs/dump.json

Lines changed: 178 additions & 177 deletions
Large diffs are not rendered by default.

docs/file/src/Editor.js.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
<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>
225225
<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>
226226
<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>
228228
<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>
229229
<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>
230230
<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,7 +288,8 @@
288288
</nav>
289289

290290
<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 &apos;./configuration/LoggerConfig&apos;;
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 &apos;./configuration/LoggerConfig&apos;;
292293
import * as DefaultBehaviors from &apos;./configuration/DefaultBehaviors&apos;;
293294
import * as DefaultConfiguration from &apos;./configuration/DefaultConfiguration&apos;;
294295
import * as DefaultStyles from &apos;./configuration/DefaultPenStyle&apos;;
@@ -555,14 +556,13 @@
555556
* Launch the import.
556557
* @param {Editor} editor
557558
* @param {Model} model
558-
* @param {{x: Number, y: Number}} point Insert point coordinates
559559
* @param {Blob} data
560560
*/
561-
function launchImport(editor, model, point, data) {
562-
if (editor.recognizer &amp;&amp; editor.recognizer.importContent) {
561+
function launchImport(editor, model, data) {
562+
if (editor.recognizer &amp;&amp; editor.recognizer.import_) {
563563
editor.recognizerContext.initPromise
564564
.then(() =&gt; {
565-
editor.recognizer.importContent(editor.recognizerContext, model, point, data, (err, res, ...types) =&gt; {
565+
editor.recognizer.import_(editor.recognizerContext, model, data, (err, res, ...types) =&gt; {
566566
recognizerCallback(editor, err, res, ...types);
567567
});
568568
});
@@ -573,14 +573,15 @@
573573
* Launch the convert with all editor relative configuration and state.
574574
* @param {Editor} editor
575575
* @param {Model} model
576+
* @param {String} conversionState
576577
*/
577-
function launchConvert(editor, model) {
578+
function launchConvert(editor, model, conversionState) {
578579
if (editor.recognizer &amp;&amp; editor.recognizer.convert) {
579580
editor.recognizerContext.initPromise
580581
.then(() =&gt; {
581582
editor.recognizer.convert(editor.recognizerContext, model, (err, res, ...types) =&gt; {
582583
recognizerCallback(editor, err, res, ...types);
583-
});
584+
}, conversionState);
584585
});
585586
}
586587
}
@@ -1142,10 +1143,10 @@
11421143
/**
11431144
* Convert the current content
11441145
*/
1145-
convert() {
1146+
convert(conversionState = &apos;DIGITAL_EDIT&apos;) {
11461147
if (this.canConvert) {
11471148
triggerCallbacks(this, undefined, Constants.EventType.CONVERT);
1148-
launchConvert(this, this.model);
1149+
launchConvert(this, this.model, conversionState);
11491150
}
11501151
}
11511152

@@ -1170,13 +1171,12 @@
11701171

11711172
/**
11721173
* Import content.
1173-
* @param {{x: Number, y: Number}} point Insert point coordinates
11741174
* @param {Blob|*} data Data to import
11751175
* @param {String} [mimetype] Mimetype of the data, needed if data is not a Blob
11761176
*/
1177-
importContent(point, data, mimetype) {
1177+
import_(data, mimetype) {
11781178
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);
11801180
}
11811181

11821182
/**

docs/file/src/EditorFacade.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
<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>
225225
<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>
226226
<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>
228228
<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>
229229
<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>
230230
<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>

0 commit comments

Comments
 (0)