Giter Site home page Giter Site logo

Comments (8)

sergeichestakov avatar sergeichestakov commented on September 4, 2024 2

Thanks @jsjoeio! Just published an update to the NPM package with the above commit included. Feel free to upgrade to v0.19.0-beta.8 and let us know if something's not working!

from codemirror-vim.

jsjoeio avatar jsjoeio commented on September 4, 2024 2

Will do - thank you @sergeichestakov!

from codemirror-vim.

nightwing avatar nightwing commented on September 4, 2024 1

You are right. cm property exists on the js object, and in typescript can be used with a hack like (view as any).cm.

I am not sure what can we do to extend the EditorView in a way that would not break type system.

Maybe we should export getCm(view: EditorView): CodeMirror|null function similar to https://codemirror.net/6/docs/ref/#search.getSearchQuery

from codemirror-vim.

jsjoeio avatar jsjoeio commented on September 4, 2024 1

Hooray! That worked. Thank you. I like the idea of having a hook called getCm where you pass in an EditorView.

That sounds nice.

Thank you very much for the two solutions and the fast reply.

from codemirror-vim.

nightwing avatar nightwing commented on September 4, 2024 1

fixed in 1ad7453

from codemirror-vim.

nightwing avatar nightwing commented on September 4, 2024

There is no cm6 style api, but you can use the old cm5 api

import {Vim} from "@replit/codemirror-vim"

var view = new EditorView({...})
Vim.exitInsertMode(view.cm)

or

Vim.handleKey(_view.cm, "<Esc>")

from codemirror-vim.

jsjoeio avatar jsjoeio commented on September 4, 2024

Hmm...I must be missing something. TypeScript says that .cm does not exist on view. What am I doing wrong?

image

https://codesandbox.io/s/cm6-vim-test-mq5m9?file=/src/index.ts

from codemirror-vim.

jsjoeio avatar jsjoeio commented on September 4, 2024

@nightwing when will you publish a new version with these changes? (may I suggest this)

from codemirror-vim.

Related Issues (20)

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.