Coder Social home page Coder Social logo

raw's People

Contributors

alcarazzam avatar dependabot[bot] avatar gohabereg avatar goldenjaden avatar nespecc avatar polinashneider avatar robonetphy avatar talyguryn avatar tatianafomina 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

raw's Issues

Bug in Firefox when dynamically populating the field

There's a weird bug on Firefox (v81) where movement keys jump to next/previous block and not next/previous character. This happens only if you dynamically load content to Editorjs and one of the blocks is a raw block.

Steps to reproduce:

  1. Load the Editorjs with this code:
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/@editorjs/raw@latest"></script>

<div id="editorjs"></div>

<script>
  const editor = new EditorJS({
    tools: {
      raw: RawTool
    },
    data: {
      blocks : [
        {
          type : "paragraph",
          data : {
            text : "Lorem ipsum"
          }
        },
        {
          type : "raw",
          data : {
            html : "Whatevs"
          }
        }
      ]
    }
  })
</script>
  1. Click the end of the Whatevs text with latest Firefox and press arrow left on keyboard. The cursor moves to previous block instead of moving to between letters v and s.

If I create a new Editorjs without prepopulating data and recreate those fields, this does not happen and moving the cursor using arrow keys in raw textarea works as it should.

This bug is more than mere annoyance, because it happens also when using backspace to delete characters. The cursor jumps to previous block and consecutive key presses remove characters from there instead of the ones the user intended to remove.

I'm not sure if this is a bug in Editorjs or this plugin, but you can prevent this behaviour by adding the following to this plugin's drawView() function:

textarea.addEventListener('keydown', function (event) {
  const blockKeys = ['ArrowRight', 'ArrowLeft', 'Backspace'];

  if (blockKeys.includes(event.key)) {
    event.stopPropagation();
  }
});

But this might have some unwanted side effects. There are some open bugs in Bugzilla related to Firefox's textarea that do not exist on other browsers, so the easier route might be using <div contenteditable="true"> instead of <textarea>, like in paragraph plugin.

No HTML tags in returned code

raw plugin version: 2.1.1 (lastest)
editor.js version: 2.17.0 (lastest)

The raw plugin is not returning the HTML tags in the returned code after calling the save() function of the editor. For example, the following code:

<b>CODE<b>

returns

{
    "time" : 1584382663969,
    "blocks" : [
        {
            "type" : "raw",
            "data" : {
                "html" : "CODE"
            }
        }
    ],
    "version" : "2.17.0"
}

This issue maybe related to the editor's sanitizer.

Add a 'caption' field

This feature will be useful because it allows leaving a description of the inserted HTML fragments.

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.