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

Commit bae13a0

Browse files
steven.roulleauleJsboureau
authored andcommitted
chore: bump to 1.5.0 + changelog
1 parent 904cbdf commit bae13a0

File tree

49 files changed

+364
-229
lines changed

Some content is hidden

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

49 files changed

+364
-229
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
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

dist/iink.esm.js

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

dist/iink.esm.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.

dist/iink.min.js

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

dist/iink.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/Editor.html

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

docs/Editor.js.html

Lines changed: 35 additions & 25 deletions
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

Lines changed: 4 additions & 3 deletions
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

Lines changed: 3 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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>

0 commit comments

Comments
 (0)