danpros / htmly

Simple and fast databaseless PHP blogging platform, and Flat-File CMS
https://www.htmly.com
GNU General Public License v2.0
1.09k stars 264 forks source link

How to change editor #324

Closed SGD-DEV closed 10 months ago

SGD-DEV commented 7 years ago

Hello is it possible to change the editor to ckeditor or tinyMCE or bootstrap editor with source code options ?

SGD-DEV commented 7 years ago

http://summernote.org/

CodeAlDente commented 7 years ago

Well, the current editor allows HTML but you should use markdown as much as you can to format your texts.

SGD-DEV commented 7 years ago

i know but markdown support no div with classes..

CodeAlDente commented 7 years ago

I fully understand your point of view.

Sometimes I really like to use different colors to highlight a specific part in a text. But this is not what markdown is for. It keeps everything simple and clean in a way so we can take the output 1:1 into a plaintext without losing the meaning of the text.

A really good point to deal with this would be by creating a new post type "HTML" where we can use pure HTML along with a WYSIWYG editor like the one you described.

SGD-DEV commented 7 years ago

I know what markdown is for. Please understand. Some People need sometimes a litle bit more as only clean text and highlight this text..

So it was pretty if admin can switch the editor.

The htmly sytem is very nice but the markdown is create clean output but is not very cool.

SGD-DEV commented 7 years ago

Hi i have it.

vvcares commented 4 years ago

Anybody able to integrate with CKEditor or Summernote ?

oleteacher commented 3 years ago

Fairly simple to replace the markdown editor with CKEditor. Not sure the markdown supporters will even like the thought, but some people need a little more than markdown can offer. In the classroom, CKEditor is all we use, so had to try adding it during my testing of HTMLY.

Our installs are never accessible from the internet and they cannot access the internet, so not worried about security. Maybe the creator can chime in and say if there is security issue.

This is purely a test and you would still need to disable/remove Markdown.Editor.js.

First thing you need to add ckeditor js in files add-content-html.php and edit-content.html.php:

<script src="https://cdn.ckeditor.com/4.16.0/standard/ckeditor.js"></script>

Second thing is disable the the markdown editor in add-content-html.php and edit-content.html.php (temp solution):

<!--<div id="wmd-button-bar" class="wmd-button-bar"></div>-->

Third is add the script to activate for textarea. I placed it right before closing div that contains the texarea. Needs to be in both above files:

<script>
CKEDITOR.replace( 'content', {
allowedContent: true,
});
</script>

That is it. The allowedContent: true will setup so you can use things like YouTube iframe embeds (we do not use - only sharing for online users).

At this point you will have an error in console about Markdown.Editor.js which I assume can be removed. If I recall, this removed the image upload function, so keep that in mind. There may be other issues, but I only wanted to demonstrate that fairly simple to add CKEditor support.

Now the issue is all your changes will be gone on next update of HTMLY:)

dirmanhana commented 3 years ago

open system\admin\views and extract this file

add-content-html.php and edit-content.html.php

file.zip

danpros commented 10 months ago

This issue is too old, I will close this one. Please create new issue for possible improvements. Thanks