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:
@@ -659,6 +659,115 @@ std::wstring FunctionBase::prepare_doc_url(const std::wstring & local_url)
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::prepare_current_dir(const wchar_t * local_url, pt::WTextStream & url)
|
||||
{
|
||||
prepare_doc_url(nullptr, url);
|
||||
|
||||
for(Item * dir : cur->request->dir_tab)
|
||||
{
|
||||
if( !dir->url.empty() )
|
||||
url << L"/" << dir->url;
|
||||
}
|
||||
|
||||
if( local_url )
|
||||
{
|
||||
url << local_url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::prepare_current_dir(const wchar_t * local_url, std::wstring & url)
|
||||
{
|
||||
pt::WTextStream stream;
|
||||
prepare_current_dir(local_url, stream);
|
||||
stream.to_str(url);
|
||||
}
|
||||
|
||||
|
||||
std::wstring FunctionBase::prepare_current_dir(const wchar_t * local_url)
|
||||
{
|
||||
std::wstring url;
|
||||
prepare_current_dir(local_url, url);
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
std::wstring FunctionBase::prepare_current_dir(const std::wstring & local_url)
|
||||
{
|
||||
return prepare_current_dir(local_url.c_str());
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::prepare_current_item(const wchar_t * local_url, pt::WTextStream & url)
|
||||
{
|
||||
prepare_current_dir(nullptr, url);
|
||||
|
||||
if( cur->request->is_item )
|
||||
url << L"/" << cur->request->item.url;
|
||||
|
||||
if( local_url )
|
||||
{
|
||||
url << local_url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::prepare_current_item(const wchar_t * local_url, std::wstring & url)
|
||||
{
|
||||
pt::WTextStream stream;
|
||||
prepare_current_item(local_url, stream);
|
||||
stream.to_str(url);
|
||||
}
|
||||
|
||||
|
||||
std::wstring FunctionBase::prepare_current_item(const wchar_t * local_url)
|
||||
{
|
||||
std::wstring url;
|
||||
prepare_current_item(local_url, url);
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
std::wstring FunctionBase::prepare_current_item(const std::wstring & local_url)
|
||||
{
|
||||
return prepare_current_item(local_url.c_str());
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::prepare_current_function(const wchar_t * local_url, pt::WTextStream & url)
|
||||
{
|
||||
prepare_current_item(nullptr, url);
|
||||
url << L"/" << fun.url;
|
||||
|
||||
if( local_url )
|
||||
{
|
||||
url << local_url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::prepare_current_function(const wchar_t * local_url, std::wstring & url)
|
||||
{
|
||||
pt::WTextStream stream;
|
||||
prepare_current_function(local_url, stream);
|
||||
stream.to_str(url);
|
||||
}
|
||||
|
||||
|
||||
std::wstring FunctionBase::prepare_current_function(const wchar_t * local_url)
|
||||
{
|
||||
std::wstring url;
|
||||
prepare_current_function(local_url, url);
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
std::wstring FunctionBase::prepare_current_function(const std::wstring & local_url)
|
||||
{
|
||||
return prepare_current_function(local_url.c_str());
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::redirect_to(const wchar_t * url, bool append_domain)
|
||||
{
|
||||
if( cur->request->is_htmx_request )
|
||||
@@ -674,16 +783,19 @@ void FunctionBase::redirect_to(const wchar_t * url, bool append_domain)
|
||||
}
|
||||
else
|
||||
{
|
||||
if( append_domain )
|
||||
if( cur->request->container_type == Request::ContainerType::container_raw )
|
||||
{
|
||||
prepare_doc_url(url, cur->request->redirect_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
cur->request->redirect_to = url;
|
||||
}
|
||||
if( append_domain )
|
||||
{
|
||||
prepare_doc_url(url, cur->request->redirect_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
cur->request->redirect_to = url;
|
||||
}
|
||||
|
||||
cur->request->redirect_type = Header::status_303_see_other;
|
||||
cur->request->redirect_type = Header::status_303_see_other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -899,8 +1011,93 @@ void FunctionBase::update_content(const wchar_t * frame, const wchar_t * dom_tar
|
||||
|
||||
void FunctionBase::close_modal_dialogs()
|
||||
{
|
||||
pt::Space & trigger = cur->request->out_headers.get_add_space(Header::hx_trigger);
|
||||
trigger.add(L"winix:closedialogs", true);
|
||||
if( cur->request->is_htmx_request )
|
||||
{
|
||||
pt::Space & trigger = cur->request->out_headers.get_add_space(Header::hx_trigger);
|
||||
trigger.add(L"winix:closedialogs", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::push_url_to_current_dir(const wchar_t * local_url)
|
||||
{
|
||||
if( cur->request->is_htmx_request )
|
||||
{
|
||||
pt::WTextStream url;
|
||||
prepare_current_dir(local_url, url);
|
||||
cur->request->out_headers.add(Header::hx_push_url, url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::push_url_to_current_item(const wchar_t * local_url)
|
||||
{
|
||||
if( cur->request->is_htmx_request )
|
||||
{
|
||||
pt::WTextStream url;
|
||||
prepare_current_item(local_url, url);
|
||||
cur->request->out_headers.add(Header::hx_push_url, url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::push_url_to_current_function(const wchar_t * local_url)
|
||||
{
|
||||
if( cur->request->is_htmx_request )
|
||||
{
|
||||
pt::WTextStream url;
|
||||
prepare_current_function(local_url, url);
|
||||
cur->request->out_headers.add(Header::hx_push_url, url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::redirect_to_current_dir()
|
||||
{
|
||||
pt::WTextStream url;
|
||||
prepare_current_dir(nullptr, url);
|
||||
redirect_to(url, false);
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::redirect_to_current_item()
|
||||
{
|
||||
pt::WTextStream url;
|
||||
prepare_current_item(nullptr, url);
|
||||
redirect_to(url, false);
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::redirect_to_current_function()
|
||||
{
|
||||
pt::WTextStream url;
|
||||
prepare_current_function(nullptr, url);
|
||||
redirect_to(url, false);
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::redirect_if_needed(bool was_url_changed)
|
||||
{
|
||||
if( cur->request->container_type == Request::ContainerType::container_raw )
|
||||
{
|
||||
/* save_and_close is not used at the moment anywhere in templates */
|
||||
if( cur->request->post_in.has_key(L"save_and_close") )
|
||||
{
|
||||
redirect_to_current_item();
|
||||
}
|
||||
else
|
||||
if( was_url_changed )
|
||||
{
|
||||
if( cur->request->is_htmx_request )
|
||||
{
|
||||
push_url_to_current_function();
|
||||
}
|
||||
else
|
||||
{
|
||||
system->RedirectToLastFunction(nullptr, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user