jakiestfu / Medium.js

A tiny JavaScript library for making contenteditable beautiful (Like Medium's editor)

Home Page:http://jakiestfu.github.io/Medium.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate NewLine at Current Carret Position

Sh1nto opened this issue · comments

Hi,

i made a testepage http://midl.de/test.html

The Problem is that Shift+Enter doesn't work es expected:

The HTML is:
<div class="contenteneditable">
<h1>Header</h1>
<p class="text">
My Content
</p>
</div>

Windows Chrome latest Version:
1.) When i'm editing in

and press Shift+Enter it adds a

between

and
2.) When editing the Headline an press Shift+Enter

is added to the end and the cursor jumps to the end
3.) No matter what i do, Shift+Enter always appends to the end of the Contenteditable div

When commenting in line:
469 newEl.innerHTML = ' ';

the
disapperears, but the
will not show up in the current

In line 476 this.element.appendChild(newEl);

this.element refers to the outer div, not to the current


I can't find a place where this.element is set again, after the initial one in line 185.

I'm working on windows, an using the latest zip from GitHub.

In Firefox it's also Appending the
to the end, and not to the current

, but in Firefox there is no
generated. Also, ager the br is appended, you can't type anymore.

In IE 11 it's the same problem.

In all Browser, just pressing Enter, enters the right

at current carret position.

I'm doing somethind wrong or unintended?