GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.38k stars 4.06k forks source link

[question] How to mix font size in the middle of a text? #226

Closed rgcarrasqueira closed 7 years ago

rgcarrasqueira commented 7 years ago

Hi Art!

I'm having a issue with grapejs inline editing. First of all I've tried to use ckeditor with grapejs but it is not a good idea. Ckeditor create a lot of waste code inside the html code and grapesjs has some problems to deal with it, for example disappearing p tags created by ckeditor from the content. So I gave up the idea to use both and I'm trying to use the native text editor.

But the text editor native from grapesjs has an issue that if i need to put text with two distincts font sizes in the same sentence, it is not allowed to do that. To create a text with two font sizes, I have to put each one at a respective row, i think it is not good. Do you have any idea, (or has any settings to apply) on how to deal with that?

Thanks a lot kapture 2017-08-10 at 9 34 31

artf commented 7 years ago

Yeah it's how the Style Manager supposed to work, all the styles are applied to the selected component, not the text. The native text editor is pretty simple and I didn't try with more complex cases but you might try to add another button to it which creates the component, just like the link.

var editor  = grapesjs.init({
  ...
  rte: {
        commands  : [{
          command: 'bold',
          title: 'Bold',
          class: 'fa fa-bold',
        },{
          command: 'italic',
          title: 'Italic',
          class: 'fa fa-italic',
        },{
          command: 'underline',
          title: 'Underline',
          class: 'fa fa-underline',
         },{
          command: 'strikethrough',
          title: 'Strikethrough',
          class: 'fa fa-strikethrough',
          group: 'format'
        },{
          command: 'insertHTML',
          title: 'Insert element',
          class: 'fa fa-bold',
          args: '<b style="color:red">${content}</b>',
         }],
      },
});

About the CKeditor, maybe there is some option to set which removes that waste. There is also a possibility to attach any other RTE (how-to)

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.