Giter Club home page Giter Club logo

slate-edit-code's Issues

All code ending up in a single line block

It seems like in the latest version 0.13.2 there are not multiple code line blocks created in the editor, all of the code is put on a single block (in this case my lineType option is set to code-line) with newline characters ignored:

{
  "kind": "block",
  "type": "code",
  "isVoid": false,
  "data": {},
  "nodes": [
    {
      "kind": "block",
      "type": "code-line",
      "isVoid": false,
      "data": {},
      "nodes": [
        {
          "kind": "text",
          "leaves": [
            {
              "kind": "leaf",
              "text": "type\ndescription\nname\n\nonDocumentCreate(document, settings, actor) {\n\n}\n\nonDocumentDelete() {\n\n}\n\nonCollectionCreate() {\n\n}",
              "marks": []
            }
          ]
        }
      ]
    }
  ]
}

Weird behaviour on backspace

When pressing backspace, sometimes the change is not reflected directly in Slate (even when nothing is done by the plugin: default behaviour).

It may be a bug in Slate.

Accepting data in toggle & wrap functions

Hi folks, thank you as always for the plugin! I was wondering if the toggle and wrap functions should take an optional data to be able to pass in things like syntax (and thus allowing easier interoperability with slate-prism).

My personal usecase is Github style markdown of three ~~~/``` followed by the language name. Using regex, I can capture the syntax proposed but can't use the wrap or `toggle` functions to set the code block.

The other alternative would be to do an insertBlock but since the wrap & toggle seem to be exposed utilities, it felt 'safer' to use those.

Thoughts?

Publish example

An example should be published to GH Pages to showcase the plugin.

Add line numbers

Hi,

Is it possible to add line numbers with this plugin?

Thanks.

How to insert code blocks?

What exactly do you have to do to insert a slate-edit-code block once this is installed and added as a plugin?

I assume it's not all blocks by default. If it is, tab behavior is not working properly (tab loses focus)

Edition doesn't mean editing

At first I thought it was weird wording as in "the Coding Edition of Slate", but I think it should be "editing"

And the description should use the singular of block, so "A Slate plugin to handle code block editing"

Prism highlighting does not update all lines when changing syntax

This probably has something to do with the lines refactor: #10. The more basic Slate code-highlighting example does not have this issue: http://slatejs.org/#/code-highlighting

Steps to Reproduce

  • open a document on gitbook.com
  • make a code block with
var line1;
var line2;
  • change syntax to javascript, then to css
  • only currently focused line is updated
  • if you focus the beginning of the incorrectly highlighted line, it triggers prism to update it
  • if you focus the end of the incorrectly highlighted line, it throws an error

Allow custom indent

Hey, currently there is a default indentation defined as a const. Could you please maybe make it configurable via the options or export a function to set default indents?

Multiple code blocks no longer work

Previously this functionality worked fine but with the upgrade to 0.13.2 and slate 0.30.X if there are multiple code blocks in a document only the first one is displayed, the text content from subsequent blocks disappears.

This bug disappears when commenting out the slate-edit-code plugin.

Not compatible with slate 0.15

Just a note that the current version is not compatible with slate 0.15. The library expects Slate 0.14.

In case it was just a versioning issue, I tried changing the peer dependencies but I got this error:

Uncaught TypeError: rule.match is not a function(…)

I haven't investigated too much. Just wanted to give you a heads up.

Sunny

Attempting to paste over multiple lines of code results in error

If you highlight a line and paste over it, it works perfectly.

If you highlight 2 or more lines and paste over them with text from anywhere besides the nodes you are pasting over, you'll get Uncaught Error: Could not find a node with key "###"

If you copy identical text or non-HTML (plaintext) over the nodes, it generally seems to work.

If you use Ctrl+A to select all contents of the codebox and paste, it seems to fail universally, even if you paste plaintext.

How to do syntax highlighting?

The docs don't make this clear, but if I used Prism.js markup to render the code_block block, will the indentation behavior work?

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.