GithubHelp home page GithubHelp logo

iinkts's People

Contributors

blatinville avatar lejsboureau avatar mathieuruellanmyscript avatar srobert-myscript avatar torebo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

iinkts's Issues

Server state randomly corrupts and collapses the iink editor content

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())

Before collapse:
pre-jumble

After collapse:
after-jumble

Editor styles unavailable in shadow dom elements

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.

Reliance on discontinued `crypto-js` requires node/browser pollyfill

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.