HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Ckeditor for latest vanilla 3 is much needed
Ckeditor for latest vanilla 3 is much needed someone please help
0
Ckeditor for latest vanilla 3 is much needed someone please help
Comments
how much $$$ needed?
I totally agree that there is a strong need for a Rich Editor alternative. And why not CKEditor?
In fact I have toyed around with Pell, Trix, TrumboWygg, EasyMDE & ProseMirror in the last weks/months. But everytime I start with something like that I face some most probably trivial JavaScript problems that I cannot overcome.
I tend to prefer small scripts that's why I never would have given CKEditor a chance. But it might be good for getting into that new JavaScript-land. I have started working on it. But some basic things are not working yet, most notably the editor content must be cleared after a comment is posted.
I would like to have that all jQuery free. Just because I guess there is no need for jQuery.
What's working:
Open ToDos:
There are a lot of things to do. But maybe some JS-savvy person can support me in some of the problems...
JQ is great! and we mix it with JS. We use JQ as well as JQUI (datepicker!) and JQMobile.
Good job, @R_J. Does CKEditor itself require jQuery? As long as Vanilla still requires jQuery and loads it on the page, I suppose it's okay to mix it in when necessary. Also, I believe CKEditor's license is compatible with GPL2 so that's good.
I actually checked out Trumbowyg and EasyMDE for a non-PHP project recently too. Rich Editor is nice for forums, but for some applications like writing news articles or most blog posts, a full WYSIWYG HTML editor is much nicer. For example, integrated media manager (some WYSIWYG only provide it as a paid plugin), special HTML blocks for image galleries, and aligning and resizing images (images should not always be centered/featured in my opinion).
On a related note, block editors like WordPress' new Gutenberg and Ghost's editor aren't bad at all for blogging. In a forum, the feature set can be simplified, but fuller editors can be beneficial for certain types of content.
Add Pages to Vanilla with the Basic Pages app
Here's a code snippet from a function with JQ and JQUI:
if (c('EnabledPlugins.jqueryui',false) && $dropdown == false) {
echo $sender->Form->TextBox($field, ['maxlength' => 10, 'id' => $field, "placeholder" => $tip,
"value" => $value, "class"=> $class, "title" => $title]);
$id = '$("#'.$field.'")';
echo '<script Type="text/javascript"> '.$id.'.click(function(){'.
$id.'.datepicker({dateFormat:"yy-mm-dd",minDate:-366,maxDate:"+1Y +1D",changeMonth: true,
changeYear: true }).datepicker("show"); }); </script>';
}
Just to give some tips here:
Delete editor content after posting
We have an event that fires when comments have been submitted. Listen to that you can clear the bodybox. It might be named for comments, but it happens to be used for all bodyboxes. Here's kind of how Rich Editor does it
Mentions
This is one of the more complex pieces of Rich Editor and advanced editor. Placing the mention box is really, really hard. Placing and and announcing properly to screen-readers that it's available and it's state is even harder.
If you just want the completion results though, you might want to take a look at
UserSuggestionsActions
andUserSuggestionsModel
. That has:/api/v2/users/by-names
endpoint.Ensure CKEditor is only loaded if format is HTML
This is best to do in PHP
gdn_form_beforeBodyBox_handler
.About the state of Rich Editor
If you actually want a WYSIWYG editor, but just take issue with some decisions made in the Rich Editor implementation, I'm happy assist anyone that wants to contribute. The following items our on the roadmap, but have not been implemented due to lack of time and manpower.
If you just have opposition to a WYSIWYG editor in general, I would recommend continuing to use Advanced Editor. Personally I really like markdown, but I understand a lot of non-technical people prefer a WYSIWYG editor.
Thanks for the feedback! CKEditor is a good choice since there are a lot of plugins which make implementing other features quite easy. Mentions is really easy. I'm quite happy with what I have right now: https://github.com/R-J/rj-ckeditor/wiki
It has been very easy to do the uploads with the media api, but the result in the Media table is very unsatisfying right now and i also would like to see thumbnails being created automatically. That's why I think I have to invest some time in that
I just bypass the whole vanillaF upload process altogether. But that is just me. I use elFinder
@charrondev that by-names() endpoint is very much what I need. But pulling in all those requirements from UserSuggestions-Modules is beyond my knowledge and I would assume that they would blow up the code very much. Furthermore integrating them with what CKEditor offers is beyond my capabilities, too.
Since the result of the endpoint isn't exactly what I need and I would like to add a field to the result, I tried to write a wrapper for it like that:
But the result is always:
Fatal Error in Vanilla\Web\Controller.permission();
Session not available.
The error occurred on or near: /usr/share/nginx/html/vanilla/library/Vanilla/Web/Controller.php
Can you see what I am missing?
Ah, whatever... I see I added a complexitiy layer to it.
That works, I just have to find out how to work with the Data object, but I assume that will be no problem, with the getData and setData methods
@diona754 Here is a version which might not work a 100% but there is not much missing, I'd say: https://github.com/R-J/rj-ckeditor 😎
There is an ugly CSS glitch with the "type here" placeholder and I would be thankful if someone could assist with that.