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

Commit c3f5c58

Browse files
committed
Pull request #56: chore: bump to 1.5.0 + changelog
Merge in WS/iink-js from chore/prepare-release to master * commit 'bae13a0a0e4dd3d5212e7c9991005759e4005ac4': chore: bump to 1.5.0 + changelog
2 parents 4149c8c + bae13a0 commit c3f5c58

File tree

45 files changed

+354
-219
lines changed

Some content is hidden

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

45 files changed

+354
-219
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# [v1.5.1](https://github.com/MyScript/iinkJS/tree/v1.5.1)
2+
3+
## Bug fix
4+
@Editor
5+
- fix change configuration restart websocket connection
6+
- fix lost connection due to inactivity is now displayed
7+
- fix style is wrapped by global class and can be customized
8+
9+
@examples
10+
- fix bad position of the searching highlight in searching text example
11+
- new examples with eraser
12+
13+
## Features
14+
- erase mode is now an option in websocket text
15+
16+
## Chore
17+
- refactor of examples
18+
119
# [v1.4.5](https://github.com/MyScript/iinkJS/tree/v1.4.5)
220

321
## Bug fix

docs/Editor.html

+55-55
Large diffs are not rendered by default.

docs/Editor.js.html

+35-25
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h1 class="page-title">Editor.js</h1>
7070
*/
7171
function manageResetState (editor, model) {
7272
// If strokes moved in the undo redo stack then a clear is mandatory before sending strokes.
73-
if (editor.recognizer.reset &amp;&amp; RecognizerContext.isResetRequired(editor.recognizerContext, model)) {
73+
if (editor.recognizer.reset &amp;&amp; !editor.isErasing &amp;&amp; RecognizerContext.isResetRequired(editor.recognizerContext, model)) {
7474
return editor.recognizer.reset(editor.recognizerContext, model)
7575
}
7676
return null
@@ -343,7 +343,9 @@ <h1 class="page-title">Editor.js</h1>
343343
* @param {PenStyle} [penStyle] Custom style to apply
344344
* @param {Behaviors} [behaviors] Custom behaviors to apply
345345
*/
346-
constructor (element, configuration, penStyle, theme, behaviors) {
346+
constructor (element, configuration, penStyle, theme, behaviors, globalClassCss) {
347+
globalClassCss = globalClassCss || 'ms-editor'
348+
347349
const styleElement = document.createElement('style')
348350
styleElement.appendChild(document.createTextNode(''))
349351
element.appendChild(styleElement)
@@ -357,7 +359,7 @@ <h1 class="page-title">Editor.js</h1>
357359
* @type {Element}
358360
*/
359361
this.domElement = element
360-
this.domElement.classList.add('ms-editor')
362+
this.domElement.classList.add(globalClassCss)
361363

362364
// eslint-disable-next-line no-undef
363365
this.loader = document.createElement('div')
@@ -393,7 +395,6 @@ <h1 class="page-title">Editor.js</h1>
393395
*/
394396
this.innerBehaviors = DefaultBehaviors.overrideDefaultBehaviors(behaviors)
395397
this.configuration = configuration
396-
this.smartGuide = SmartGuide.createSmartGuide(this)
397398

398399
/**
399400
* Pen color used only for pending stroke
@@ -405,6 +406,9 @@ <h1 class="page-title">Editor.js</h1>
405406
this.penStyle = penStyle
406407
this.penStyleClasses = ''
407408

409+
// To override pointerType when ERASER
410+
this.isErasing = false
411+
408412
this.domElement.editor = this
409413
}
410414

@@ -416,28 +420,17 @@ <h1 class="page-title">Editor.js</h1>
416420
set configuration (configuration) {
417421
this.loader.style.display = 'initial'
418422
this.error.style.display = 'none'
419-
420-
/**
421-
* Update function call when some configuration property is updated
422-
* @param {string} value
423-
*/
424-
const update = (value) => {
425-
const defaultLang = !Object.keys(Constants.Languages).includes(value)
426-
this.theme['.text']['font-family'] = defaultLang ? Constants.Languages.default : Constants.Languages[value]
427-
this.behavior = this.behaviors.getBehaviorFromConfiguration(this.behaviors, this.innerConfiguration)
428-
}
429-
430-
const watcher = {
431-
update,
432-
prop: 'lang'
433-
}
434-
435423
/**
436424
* @private
437425
* @type {Configuration}
438426
*/
439-
this.innerConfiguration = DefaultConfiguration.overrideDefaultConfiguration(configuration, watcher)
427+
this.innerConfiguration = DefaultConfiguration.overrideDefaultConfiguration(configuration)
440428
this.behavior = this.behaviors.getBehaviorFromConfiguration(this.behaviors, this.innerConfiguration)
429+
if (this.smartGuide) {
430+
SmartGuide.reset(this.smartGuide)
431+
} else {
432+
this.smartGuide = SmartGuide.createSmartGuide(this)
433+
}
441434
}
442435

443436
/**
@@ -698,6 +691,17 @@ <h1 class="page-title">Editor.js</h1>
698691
return this.recognizerContext ? this.recognizerContext.initialized : false
699692
}
700693

694+
enableEraser () {
695+
this.isErasing = true
696+
this.domElement.classList.add('erasing')
697+
}
698+
699+
disableEraser () {
700+
document.body.style.cursor = 'initial'
701+
this.isErasing = false
702+
this.domElement.classList.remove('erasing')
703+
}
704+
701705
/**
702706
* Handle a pointer down
703707
* @param {{x: Number, y: Number, t: Number}} point Captured point coordinates
@@ -709,7 +713,9 @@ <h1 class="page-title">Editor.js</h1>
709713
window.clearTimeout(this.notifyTimer)
710714
window.clearTimeout(this.exportTimer)
711715
this.model = InkModel.initPendingStroke(this.model, point, Object.assign({ pointerType, pointerId }, this.theme.ink, this.localPenStyle))
712-
this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)
716+
if (!this.isErasing) {
717+
this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)
718+
}
713719
// Currently no recognition on pointer down
714720
}
715721

@@ -720,7 +726,9 @@ <h1 class="page-title">Editor.js</h1>
720726
pointerMove (point) {
721727
logger.trace('Pointer move', point)
722728
this.model = InkModel.appendToPendingStroke(this.model, point)
723-
this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)
729+
if (!this.isErasing) {
730+
this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)
731+
}
724732
// Currently no recognition on pointer move
725733
}
726734

@@ -731,7 +739,9 @@ <h1 class="page-title">Editor.js</h1>
731739
pointerUp (point) {
732740
logger.trace('Pointer up', point)
733741
this.model = InkModel.endPendingStroke(this.model, point, this.penStyle)
734-
this.renderer.drawModel(this.rendererContext, this.model, this.stroker)
742+
if (!this.isErasing) {
743+
this.renderer.drawModel(this.rendererContext, this.model, this.stroker)
744+
}
735745

736746
if (this.recognizer.addStrokes) {
737747
addStrokes(this, this.model)
@@ -1036,7 +1046,7 @@ <h1 class="page-title">Editor.js</h1>
10361046
<br class="clear">
10371047

10381048
<footer>
1039-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
1049+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
10401050
</footer>
10411051

10421052
<script>prettyPrint();</script>

docs/EditorFacade.js.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ <h1 class="page-title">EditorFacade.js</h1>
4949
* @param {PenStyle} [penStyle] Pen style to apply
5050
* @param {Theme} [theme] Theme to apply
5151
* @param {Behaviors} [behaviors] Custom behaviors to apply
52+
* @param {String} [globalClassCSS] Replace global class css 'ms-editor' to customize style
5253
* @return {Editor} New editor
5354
*/
54-
export function register (element, configuration, penStyle, theme, behaviors) {
55+
export function register (element, configuration, penStyle, theme, behaviors, globalClassCSS) {
5556
logger.debug('Registering a new editor')
56-
return new Editor(element, configuration, penStyle, theme, behaviors)
57+
return new Editor(element, configuration, penStyle, theme, behaviors, globalClassCSS)
5758
}
5859

5960
/**
@@ -89,7 +90,7 @@ <h1 class="page-title">EditorFacade.js</h1>
8990
<br class="clear">
9091

9192
<footer>
92-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
93+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
9394
</footer>
9495

9596
<script>prettyPrint();</script>

docs/configuration_Constants.js.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ <h1 class="page-title">configuration/Constants.js</h1>
113113
Error: {
114114
NOT_REACHABLE: 'MyScript recognition server is not reachable. Please reload once you are connected.',
115115
WRONG_CREDENTIALS: 'Application credentials are invalid. Please check or regenerate your application key and hmackey.',
116-
TOO_OLD: 'Session is too old. Max Session Duration Reached.'
116+
TOO_OLD: 'Session is too old. Max Session Duration Reached.',
117+
NO_ACTIVITY: 'Session closed due to no activity.'
117118
},
118119
Exports: {
119120
JIIX: 'application/vnd.myscript.jiix'
@@ -132,7 +133,7 @@ <h1 class="page-title">configuration/Constants.js</h1>
132133
<br class="clear">
133134

134135
<footer>
135-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
136+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
136137
</footer>
137138

138139
<script>prettyPrint();</script>

docs/configuration_DefaultBehaviors.js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ <h1 class="page-title">configuration/DefaultBehaviors.js</h1>
133133
<br class="clear">
134134

135135
<footer>
136-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
136+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
137137
</footer>
138138

139139
<script>prettyPrint();</script>

docs/configuration_DefaultConfiguration.js.html

+9-23
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
9999
left: 15,
100100
right: 15,
101101
top: 10
102+
},
103+
eraser: {
104+
'erase-precisely': false
102105
}
103106
},
104107
text: {
@@ -115,6 +118,9 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
115118
top: 20,
116119
left: 10,
117120
right: 10
121+
},
122+
eraser: {
123+
'erase-precisely': false
118124
}
119125
},
120126
diagram: {
@@ -160,15 +166,13 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
160166
}
161167
}
162168

163-
const isProxy = Symbol('isProxy')
164-
165169
/**
166170
* Generate parameters
167171
* @param {Configuration} configuration Configuration to be used
168172
* @param {Object} watcher: { update: function, prop: string} function to call when 'prop' is updated
169173
* @return {Configuration} Overridden configuration
170174
*/
171-
export function overrideDefaultConfiguration (configuration, watcher) {
175+
export function overrideDefaultConfiguration (configuration) {
172176
const confRef = configuration
173177
let currentConfiguration
174178
if (confRef &amp;&amp; confRef.recognitionParams.server &amp;&amp; confRef.recognitionParams.server.useWindowLocation) {
@@ -180,25 +184,7 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
180184
}
181185
logger.debug('Override default configuration', currentConfiguration)
182186

183-
const handler = {
184-
get: function (target, key) {
185-
// Nested objects are Proxy too
186-
if (key !== isProxy &amp;&amp; typeof target[key] === 'object' &amp;&amp; target[key] !== null) {
187-
return new Proxy(target[key], handler)
188-
} else {
189-
return target[key]
190-
}
191-
},
192-
set: function (obj, prop, value) {
193-
if (prop === watcher.prop) {
194-
watcher.update(value)
195-
}
196-
obj[prop] = value
197-
return true
198-
}
199-
}
200-
201-
return new Proxy(currentConfiguration, handler)
187+
return currentConfiguration
202188
}
203189

204190
export default defaultConfiguration
@@ -214,7 +200,7 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
214200
<br class="clear">
215201

216202
<footer>
217-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
203+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
218204
</footer>
219205

220206
<script>prettyPrint();</script>

docs/configuration_DefaultPenStyle.js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ <h1 class="page-title">configuration/DefaultPenStyle.js</h1>
9191
<br class="clear">
9292

9393
<footer>
94-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
94+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
9595
</footer>
9696

9797
<script>prettyPrint();</script>

docs/configuration_DefaultTheme.js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ <h1 class="page-title">configuration/DefaultTheme.js</h1>
125125
<br class="clear">
126126

127127
<footer>
128-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
128+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
129129
</footer>
130130

131131
<script>prettyPrint();</script>

docs/configuration_LoggerConfig.js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ <h1 class="page-title">configuration/LoggerConfig.js</h1>
123123
<br class="clear">
124124

125125
<footer>
126-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
126+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
127127
</footer>
128128

129129
<script>prettyPrint();</script>

docs/eastereggs_InkImporter.js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ <h1 class="page-title">eastereggs/InkImporter.js</h1>
138138
<br class="clear">
139139

140140
<footer>
141-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
141+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
142142
</footer>
143143

144144
<script>prettyPrint();</script>

docs/event_Event.js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h1 class="page-title">event/Event.js</h1>
6565
<br class="clear">
6666

6767
<footer>
68-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme.
68+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
6969
</footer>
7070

7171
<script>prettyPrint();</script>

0 commit comments

Comments
 (0)