myscript / iinkts Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
The editor styles are added to the top level of the page instead of inside the passed editor element due to the change to directly import the css file at the top of the editor class. This means elements inside shadow doms no longer receive the styles and also increases the chance of style conflicts.
In iink-js
the style element was directly added to the editor element so this was not an issue.
We use this library inside a chrome extension where we must keep our styles separate from the page we're loading on. Is there any way to replicate the old behaviour? I'm aware we can just copy and inject the iink.css ourselves, but that isn't ideal and would still result in the page having the styles added to the top level.
This is more of an inquiry/suggestion on the use of the crypto-js
library.
crypto-js
is discontinued and versions 4+ of crypto-js
rely on using the native node / browser library crypto
for some functionality .
https://github.com/brix/crypto-js/blob/develop/README.md#400
This means people using this library need to decide on either polyfilling with the node api module or relying on browser support. This is difficult to check as I'm not entirely sure what functions of crypto
are required for crypto-js
usage so it's hard to gauge browser support.
Could you provide insight on what you recommend for iink-ts
usage of crypto-js
and If possible would removing the crypto-js dependency be viable in future?
I set up a editor to automatically convert strokes to text after a couple seconds of inactivity. Before long, the server seems to tell the client to collapse everything into a jumbled mess. "Undo" does not fix the situation - running the undo command will temporarily revert to the clean state on the client side, but the next time "convert" is run the content will get messed up again.
Minimal example to recreate the issue:
export class HandwritingEditor {
private iinkEditor: IInkEditor
private editorContainer: HTMLElement
private editorElement: HTMLElement
private resizeObserver: ResizeObserver
private lastChangeID: string = ""
constructor(applicationKey: string, hmacKey: string) {
this.editorContainer = document.createElement('div')
this.editorContainer.id = 'handwriting-editor-container'
this.editorElement = document.createElement('div')
this.editorElement.id = 'handwriting-editor'
this.editorContainer.appendChild(this.editorElement)
this.iinkEditor = new IInkEditor(this.editorElement,
{
configuration: {
server: {
scheme: "https",
host: "cloud.myscript.com",
applicationKey: applicationKey,
hmacKey: hmacKey,
},
},
}
)
setTimeout(() => {
this.iinkEditor.initialize().then(() => {
this.iinkEditor.events.addEventListener("changed", (evt: any) => {
const changeID = crypto.randomUUID()
this.lastChangeID = changeID
setTimeout(() => {
if (changeID == this.lastChangeID) {
this.iinkEditor.convert()
}
}, 2000)
})
})
})
this.resizeObserver = new ResizeObserver(this.refreshSize.bind(this));
this.resizeObserver.observe(this.editorElement);
this.refreshSize()
}
getEditorContainer() {
return this.editorContainer
}
refreshSize() {
this.iinkEditor.resize()
}
}
let editor = HandwritingEditor("app key", "hmac key")
document.body.appendChild(editor.getEditorContainer())
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.