Code Monkey home page Code Monkey logo

misbehave's People

Contributors

orbitbot 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

Watchers

 avatar  avatar  avatar

misbehave's Issues

No Line Breaks When Pasting

When I paste the contents of code into a misbehave component the resulting code is displayed in single line instead of many lines the code was copied from.

Is there any way to show the line breaks of code that has has been pasted in?

De-indent removes all content before multiline selection

De-indent removes all content in code block before a multiline selection, if that selection starts before the first character on a line

Steps to reproduce

Enter and make selection as the following,

var moo = 3

>function() {
    return 42
}<

... press shift + tab:

>function() {
return 42
}<

Expected

var moo = 3

>function() {
return 42
}<

Continuous syntax highlighting support

misbehave currently intentionally works in a simplified manner when considering the possible contents of a contenteditable block, only concerning itself with the text contents of the targeted HTML tag and overwriting the content as text f.e. when performing undos and redos.

This approach is problematic if we would like to work with more complex content in the block, such as extra spans provided by syntax-highlighting libraries like Prism.js. Currently on-the-fly syntax highlighting is not possible since the extra elements added will confuse the simplistic selection and text extracting and setting functionality, causing destructive input in the wrong locations and selecting the wrong elements. A more refined approach as indicated in the following might allow for continuous syntax-highlighting:

  1. http://stackoverflow.com/questions/6240139/highlight-text-range-using-javascript
  2. http://jsfiddle.net/8mdX4/1211/
  3. https://github.com/mir3z/texthighlighter/blob/master/src/TextHighlighter.js

[1-2] Indicates how to select text across multiple elements given a start and end, which should match prefix.length and prefix.length + selected.length internally used by misbehave. The same functionality combined with a reverse approach should together with some edits to how misbehave currently works would probably be enough to implement working continuous syntax highlighting.

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.