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

Commit

Permalink
chore: bump to 1.5.0 + changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
steven.roulleau authored and leJsboureau committed Dec 14, 2021
1 parent 904cbdf commit bae13a0
Show file tree
Hide file tree
Showing 49 changed files with 364 additions and 229 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# [v1.5.1](https://github.com/MyScript/iinkJS/tree/v1.5.1)

## Bug fix
@Editor
- fix change configuration restart websocket connection
- fix lost connection due to inactivity is now displayed
- fix style is wrapped by global class and can be customized

@examples
- fix bad position of the searching highlight in searching text example
- new examples with eraser

## Features
- erase mode is now an option in websocket text

## Chore
- refactor of examples

# [v1.4.5](https://github.com/MyScript/iinkJS/tree/v1.4.5)

## Bug fix
Expand Down
8 changes: 4 additions & 4 deletions dist/iink.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/iink.esm.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/iink.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/iink.min.js.map

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions docs/Editor.html

Large diffs are not rendered by default.

60 changes: 35 additions & 25 deletions docs/Editor.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h1 class="page-title">Editor.js</h1>
*/
function manageResetState (editor, model) {
// If strokes moved in the undo redo stack then a clear is mandatory before sending strokes.
if (editor.recognizer.reset &amp;&amp; RecognizerContext.isResetRequired(editor.recognizerContext, model)) {
if (editor.recognizer.reset &amp;&amp; !editor.isErasing &amp;&amp; RecognizerContext.isResetRequired(editor.recognizerContext, model)) {
return editor.recognizer.reset(editor.recognizerContext, model)
}
return null
Expand Down Expand Up @@ -343,7 +343,9 @@ <h1 class="page-title">Editor.js</h1>
* @param {PenStyle} [penStyle] Custom style to apply
* @param {Behaviors} [behaviors] Custom behaviors to apply
*/
constructor (element, configuration, penStyle, theme, behaviors) {
constructor (element, configuration, penStyle, theme, behaviors, globalClassCss) {
globalClassCss = globalClassCss || 'ms-editor'

const styleElement = document.createElement('style')
styleElement.appendChild(document.createTextNode(''))
element.appendChild(styleElement)
Expand All @@ -357,7 +359,7 @@ <h1 class="page-title">Editor.js</h1>
* @type {Element}
*/
this.domElement = element
this.domElement.classList.add('ms-editor')
this.domElement.classList.add(globalClassCss)

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

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

// To override pointerType when ERASER
this.isErasing = false

this.domElement.editor = this
}

Expand All @@ -416,28 +420,17 @@ <h1 class="page-title">Editor.js</h1>
set configuration (configuration) {
this.loader.style.display = 'initial'
this.error.style.display = 'none'

/**
* Update function call when some configuration property is updated
* @param {string} value
*/
const update = (value) => {
const defaultLang = !Object.keys(Constants.Languages).includes(value)
this.theme['.text']['font-family'] = defaultLang ? Constants.Languages.default : Constants.Languages[value]
this.behavior = this.behaviors.getBehaviorFromConfiguration(this.behaviors, this.innerConfiguration)
}

const watcher = {
update,
prop: 'lang'
}

/**
* @private
* @type {Configuration}
*/
this.innerConfiguration = DefaultConfiguration.overrideDefaultConfiguration(configuration, watcher)
this.innerConfiguration = DefaultConfiguration.overrideDefaultConfiguration(configuration)
this.behavior = this.behaviors.getBehaviorFromConfiguration(this.behaviors, this.innerConfiguration)
if (this.smartGuide) {
SmartGuide.reset(this.smartGuide)
} else {
this.smartGuide = SmartGuide.createSmartGuide(this)
}
}

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

enableEraser () {
this.isErasing = true
this.domElement.classList.add('erasing')
}

disableEraser () {
document.body.style.cursor = 'initial'
this.isErasing = false
this.domElement.classList.remove('erasing')
}

/**
* Handle a pointer down
* @param {{x: Number, y: Number, t: Number}} point Captured point coordinates
Expand All @@ -709,7 +713,9 @@ <h1 class="page-title">Editor.js</h1>
window.clearTimeout(this.notifyTimer)
window.clearTimeout(this.exportTimer)
this.model = InkModel.initPendingStroke(this.model, point, Object.assign({ pointerType, pointerId }, this.theme.ink, this.localPenStyle))
this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)
if (!this.isErasing) {
this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)
}
// Currently no recognition on pointer down
}

Expand All @@ -720,7 +726,9 @@ <h1 class="page-title">Editor.js</h1>
pointerMove (point) {
logger.trace('Pointer move', point)
this.model = InkModel.appendToPendingStroke(this.model, point)
this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)
if (!this.isErasing) {
this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)
}
// Currently no recognition on pointer move
}

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

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

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
7 changes: 4 additions & 3 deletions docs/EditorFacade.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ <h1 class="page-title">EditorFacade.js</h1>
* @param {PenStyle} [penStyle] Pen style to apply
* @param {Theme} [theme] Theme to apply
* @param {Behaviors} [behaviors] Custom behaviors to apply
* @param {String} [globalClassCSS] Replace global class css 'ms-editor' to customize style
* @return {Editor} New editor
*/
export function register (element, configuration, penStyle, theme, behaviors) {
export function register (element, configuration, penStyle, theme, behaviors, globalClassCSS) {
logger.debug('Registering a new editor')
return new Editor(element, configuration, penStyle, theme, behaviors)
return new Editor(element, configuration, penStyle, theme, behaviors, globalClassCSS)
}

/**
Expand Down Expand Up @@ -89,7 +90,7 @@ <h1 class="page-title">EditorFacade.js</h1>
<br class="clear">

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
5 changes: 3 additions & 2 deletions docs/configuration_Constants.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ <h1 class="page-title">configuration/Constants.js</h1>
Error: {
NOT_REACHABLE: 'MyScript recognition server is not reachable. Please reload once you are connected.',
WRONG_CREDENTIALS: 'Application credentials are invalid. Please check or regenerate your application key and hmackey.',
TOO_OLD: 'Session is too old. Max Session Duration Reached.'
TOO_OLD: 'Session is too old. Max Session Duration Reached.',
NO_ACTIVITY: 'Session closed due to no activity.'
},
Exports: {
JIIX: 'application/vnd.myscript.jiix'
Expand All @@ -132,7 +133,7 @@ <h1 class="page-title">configuration/Constants.js</h1>
<br class="clear">

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration_DefaultBehaviors.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h1 class="page-title">configuration/DefaultBehaviors.js</h1>
<br class="clear">

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
32 changes: 9 additions & 23 deletions docs/configuration_DefaultConfiguration.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
left: 15,
right: 15,
top: 10
},
eraser: {
'erase-precisely': false
}
},
text: {
Expand All @@ -115,6 +118,9 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
top: 20,
left: 10,
right: 10
},
eraser: {
'erase-precisely': false
}
},
diagram: {
Expand Down Expand Up @@ -160,15 +166,13 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
}
}

const isProxy = Symbol('isProxy')

/**
* Generate parameters
* @param {Configuration} configuration Configuration to be used
* @param {Object} watcher: { update: function, prop: string} function to call when 'prop' is updated
* @return {Configuration} Overridden configuration
*/
export function overrideDefaultConfiguration (configuration, watcher) {
export function overrideDefaultConfiguration (configuration) {
const confRef = configuration
let currentConfiguration
if (confRef &amp;&amp; confRef.recognitionParams.server &amp;&amp; confRef.recognitionParams.server.useWindowLocation) {
Expand All @@ -180,25 +184,7 @@ <h1 class="page-title">configuration/DefaultConfiguration.js</h1>
}
logger.debug('Override default configuration', currentConfiguration)

const handler = {
get: function (target, key) {
// Nested objects are Proxy too
if (key !== isProxy &amp;&amp; typeof target[key] === 'object' &amp;&amp; target[key] !== null) {
return new Proxy(target[key], handler)
} else {
return target[key]
}
},
set: function (obj, prop, value) {
if (prop === watcher.prop) {
watcher.update(value)
}
obj[prop] = value
return true
}
}

return new Proxy(currentConfiguration, handler)
return currentConfiguration
}

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

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration_DefaultPenStyle.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h1 class="page-title">configuration/DefaultPenStyle.js</h1>
<br class="clear">

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration_DefaultTheme.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h1 class="page-title">configuration/DefaultTheme.js</h1>
<br class="clear">

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration_LoggerConfig.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h1 class="page-title">configuration/LoggerConfig.js</h1>
<br class="clear">

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/eastereggs_InkImporter.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ <h1 class="page-title">eastereggs/InkImporter.js</h1>
<br class="clear">

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/event_Event.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h1 class="page-title">event/Event.js</h1>
<br class="clear">

<footer>
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.
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.
</footer>

<script>prettyPrint();</script>
Expand Down
Loading

0 comments on commit bae13a0

Please sign in to comment.