improve frontend of emacs, ckeditor, tinymce, nicedit, meta and env functions

Improves in emacs:
- use htmx to send content to the controller
- show txt and formatted_txt content in the second panel
- show two tabs if "tabs" winix parameter is used
- add an option to show either one or two panels
- correctly resize the editor window (F11) when two panels are shown

Improves in ckeditor:
- use htmx to send content to the controller
- do not check automatically for ckeditor update

Improves in tinymce/nicedit/meta/env:
- use htmx to send content to the controller

while here:
- change PascalCase to snake_case in meta/env controllers
- update CodeMirror editor to 5.65.16
- udpate Showdown (markdown to html converter) to 2.1.0
This commit is contained in:
2024-07-20 15:13:27 +02:00
parent 89b37db48e
commit e63838faeb
27 changed files with 1075 additions and 496 deletions

View File

@@ -36,13 +36,10 @@
#include "core/log.h"
namespace Winix
namespace Winix::Fun
{
namespace Fun
{
Meta::Meta()
{
fun.url = L"meta";
@@ -60,7 +57,7 @@ bool Meta::has_access()
bool Meta::Parse(const std::wstring & meta_str)
bool Meta::parse(const std::wstring & meta_str)
{
return (conf_parser.parse_space(meta_str, space) == pt::SpaceParser::ok);
}
@@ -68,9 +65,9 @@ bool Meta::Parse(const std::wstring & meta_str)
bool Meta::EditAdminMeta(Item & item, const std::wstring & meta_str)
bool Meta::edit_admin_meta(Item & item, const std::wstring & meta_str)
{
if( Parse(meta_str) )
if( parse(meta_str) )
{
item.propagate_connector();
item.item_content.admin_meta = space;
@@ -99,9 +96,9 @@ return false;
bool Meta::EditMeta(Item & item, const std::wstring & meta_str)
bool Meta::edit_meta(Item & item, const std::wstring & meta_str)
{
if( Parse(meta_str) )
if( parse(meta_str) )
{
item.propagate_connector();
item.item_content.meta = space;
@@ -130,7 +127,7 @@ return false;
void Meta::ChangeAdminMeta()
void Meta::change_admin_meta()
{
// IMPROVE ME we need to show an error msg if the user is not an admin
@@ -138,23 +135,23 @@ void Meta::ChangeAdminMeta()
{
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
if( EditAdminMeta(*cur->request->last_item, meta_str) )
if( edit_admin_meta(*cur->request->last_item, meta_str) )
{
system->RedirectToLastItem();
redirect_if_needed();
}
}
}
void Meta::ChangeMeta()
void Meta::change_meta()
{
if( system->HasWriteAccess(*cur->request->last_item) )
{
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
if( EditMeta(*cur->request->last_item, meta_str) )
if( edit_meta(*cur->request->last_item, meta_str) )
{
system->RedirectToLastItem();
redirect_if_needed();
}
}
}
@@ -164,9 +161,9 @@ void Meta::ChangeMeta()
void Meta::make_post()
{
if( cur->request->IsParam(L"a") )
ChangeAdminMeta();
change_admin_meta();
else
ChangeMeta();
change_meta();
}
@@ -174,5 +171,3 @@ void Meta::make_post()
} // namespace
} // namespace Winix