10000 <p> on Enter · Issue #21 · cleditor/cleditor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

<p> on Enter #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thejmill opened this issue Jun 7, 2012 · 2 comments
Open

<p> on Enter #21

thejmill opened this issue Jun 7, 2012 · 2 comments

Comments

@thejmill
Copy link
thejmill commented Jun 7, 2012

Is there an option to make it so the enter key only does a "br" rather then a "p"

@funivan
Copy link
funivan commented Jul 25, 2012

Yes. I make it.
Paste this code at the end of the refresh function.
Possible line https://github.com/cleditor/cleditor/blob/master/jquery.cleditor.js#L913

Just comment lines that you dont need.

  $doc.bind("keyup", function(e) {
      var code = $(editor.doc.body).html()
      var regexReplace = [
        [/\s*style\s*=\s*("|')([^"']+)("|')/ig, ''], //replace styles
        [/<([^>])>\s*<\s*\/[^>]>/mgi,  ''],  //replace empty tags
        [/&nbsp;/gi,  " "], //replace spaces nbsp 
        [/<div>/gi,  '<p>'],  //replace div to p
        [/<\/div>/gi,  "</p>"]  //replace close div tag to close p tag
      ];

      // Edit code
      $.each(regexReplace, function(index, item) {
        code = code.replace(item[0], item[1]);
      });

      editor.$area.val(code);
      editor.updateFrame();
      return true;
    });

If there is any problems give me to know =)

@Andrej-in-ua
Copy link

As funivan said:

If there is any 5D12 problems give me to know =)

Chrome v22. When typing cursor sometimes randomly jumps = (
In other browsers I have not tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0