GrapesJS / preset-webpage

GrapesJS Plugin Webpage Preset
http://grapesjs.com/demo.html
BSD 3-Clause "New" or "Revised" License
335 stars 291 forks source link

format for all links created [help wanted] #49

Closed svalenciano81 closed 2 years ago

svalenciano81 commented 4 years ago

hi, i have:

grapesjs: 0.15.8 grapesjs-preset-newsletter: 0.2.20 ckeditor.js: 4 grapesjs-plugin-ckeditor - 0.0.9

i need that all links ( "A" tag ), automatically, has always same styles by default (css inlne), for example:

<a href="#" style="text-decoration:none; color:red!important!">one link </a> how i can do it?

I'm trying this:

editor = grapesjs.init({
canvasCss: ' a{color:red!important;text-decoration: none!important;}', 

in canvas seems works fine when i insert the link, but when i get html+css inline with:

var html = $scope.editor.runCommand('gjs-get-inlined-html'); the CSS of links are not inline

any idea?

artf commented 2 years ago

Instead of canvasCss you should try using protectedCss which is included in the export