adrianmak Posted November 2, 2016 Share Posted November 2, 2016 I attached bootstrap grid only classes in ckeditor custom.css Then I put grid class in body content. But why the third column dropped on next line ? Link to comment Share on other sites More sharing options...
netcarver Posted November 2, 2016 Share Posted November 2, 2016 Is there a pressing reason to mix this level of layout into your content? Would separating the columns into individual textareas and moving the layout details into your templates work better? 2 Link to comment Share on other sites More sharing options...
Macrura Posted November 2, 2016 Share Posted November 2, 2016 you could also try using a token like {{column-break}} and then use this function on your body field output: function columnizeMarkup($markup) { if(strpos($markup, '<p>{{column-break}}</p>') == false) return $markup; $bodyParts = explode('<p>{{column-break}}</p>', $markup); $colClass = 12 / count($bodyParts); $columns = ''; foreach($bodyParts as $col) { $columns .= "<div class='col-md-{$colClass}'>$col</div>"; } return '<div class="row">' . $columns . '</div>'; } 8 Link to comment Share on other sites More sharing options...
netcarver Posted November 2, 2016 Share Posted November 2, 2016 @Macrura That's quite nice, could make a useful textformatter. 3 Link to comment Share on other sites More sharing options...
Jonathan Lahijani Posted November 2, 2016 Share Posted November 2, 2016 @adrianmak I would strongly consider you don't put divs in CKeditor fields as this is a very fragile and error-prone approach. My solution to this is either (a) use HannaCodes to represent opening and closing of divs or (b) use RepeaterMatrix. 3 Link to comment Share on other sites More sharing options...
Macrura Posted November 2, 2016 Share Posted November 2, 2016 and in my example, it only works if you want to columnize the whole field, else you also need to extend that function to have a row/section break Link to comment Share on other sites More sharing options...
adrianmak Posted November 6, 2016 Author Share Posted November 6, 2016 On 11/2/2016 at 6:12 PM, netcarver said: Is there a pressing reason to mix this level of layout into your content? Would separating the columns into individual textareas and moving the layout details into your templates work better? the site is supporting responsive layout. Users will add in-line images in anywhere of the content body. In this case without using grid to layout content in the body field, the final look view in mobile devices may look not properly Link to comment Share on other sites More sharing options...
Recommended Posts