some work on integrating ckeditor4
added ezc blocks: ckeditor_old_browsers_support, ckeditor, ckeditor_small defined in ckeditor.html git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1109 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
dcc6d35cba
commit
aa58faf145
|
@ -105,9 +105,12 @@ return true;
|
|||
|
||||
// !! zmienic nazwy
|
||||
// albo w ogole te metody nie sa potrzebne teraz (byly zmiany)
|
||||
void Emacs::PostFunEmacsModifyMountPoint(bool adding)
|
||||
void Emacs::DoRedirectIfNeeded(bool adding)
|
||||
{
|
||||
if( cur->request->ParamValue(L"reqtype") != L"json" )
|
||||
{
|
||||
system->RedirectTo(cur->request->item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,13 +169,19 @@ void Emacs::MakePost()
|
|||
|
||||
if( cur->request->status == WINIX_ERR_OK )
|
||||
{
|
||||
PostFunEmacsModifyMountPoint(adding);
|
||||
DoRedirectIfNeeded(adding);
|
||||
functions->CheckSpecialFile(cur->request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Emacs: error: " << cur->request->status << logend;
|
||||
}
|
||||
|
||||
|
||||
if( cur->request->ParamValue(L"reqtype") == L"json" )
|
||||
{
|
||||
cur->request->info.Add(L"status", cur->request->status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ private:
|
|||
|
||||
bool HasAccess(const Item & item); // !! takie funkcje to nie powinny byc skladowe modelu?
|
||||
bool PostEmacsCheckAbuse(bool adding);
|
||||
void PostFunEmacsModifyMountPoint(bool adding);
|
||||
void DoRedirectIfNeeded(bool adding);
|
||||
int NotifyCodeEdit();
|
||||
int NotifyCodeAdd();
|
||||
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
[block ckeditor_old_browsers_support]
|
||||
<script>
|
||||
|
||||
[# blocks are not connected with languages yet, so don't use \{ but {]
|
||||
|
||||
|
||||
|
||||
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
|
||||
{
|
||||
CKEDITOR.tools.enableHtml5Elements( document );
|
||||
}
|
||||
|
||||
</script>
|
||||
[end]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[block ckeditor]
|
||||
<script>
|
||||
|
||||
|
||||
var editorElement = CKEDITOR.document.getById( '[0]' );
|
||||
editorElement.setAttribute( 'contenteditable', 'true' );
|
||||
|
||||
|
||||
CKEDITOR.inline( '[0]',
|
||||
{
|
||||
filebrowserBrowseUrl: '[doc_base_url][dir]ls?ckeditor_browse&fullscreen',
|
||||
customConfig : '[doc_base_url]/var/ckeditor_winix.js',
|
||||
|
||||
extraPlugins : 'sourcedialog',
|
||||
removePlugins : 'sourcearea',
|
||||
|
||||
toolbar : 'winix',
|
||||
height : '350px',
|
||||
scayt_autoStartup : false, // spellchecker disabled
|
||||
//docType : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
docType : '<!DOCTYPE html>',
|
||||
entities : false, // when true then ó becames ó,
|
||||
|
||||
toolbar_winix :
|
||||
\[
|
||||
\['Sourcedialog','-','Save','Preview','-'\],
|
||||
\['Cut','Copy','Paste','PasteText','PasteFromWord','-'\],
|
||||
\['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'\],
|
||||
|
||||
'/',
|
||||
\['Bold','Italic','Underline','Strike','-','Subscript','Superscript'\],
|
||||
\['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'\],
|
||||
\['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'\],
|
||||
\['Link','Unlink','Anchor'\],
|
||||
\['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'\],
|
||||
'/',
|
||||
\['Format','Font','FontSize'\],
|
||||
\['TextColor','BGColor'\],
|
||||
\['Maximize', 'ShowBlocks','-','About'\]
|
||||
\],
|
||||
|
||||
|
||||
contentsCss : \[[for doc_css_tab]'[if not doc_css_tab_file_is_global][doc_base_url_static][end][doc_css_tab_file]'[if doc_css_tab_has_next], [end][end]\],
|
||||
|
||||
//config.skin : 'office2003',
|
||||
|
||||
coreStyles_strike :
|
||||
{
|
||||
element : 'del',
|
||||
overrides : 'strike'
|
||||
},
|
||||
|
||||
coreStyles_underline :
|
||||
{
|
||||
element : 'span',
|
||||
attributes : { 'class' : 'underline' }
|
||||
},
|
||||
|
||||
//config.allowedContent : true, // allowes all
|
||||
disallowedContent : 'p(western)', // from copying from Office
|
||||
extraAllowedContent : 'aside caption figure figcaption article footer header section div (*); ul(*); h1(*); h2(*); p(*)'
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[end]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[block ckeditor_small]
|
||||
<script>
|
||||
|
||||
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
|
||||
{
|
||||
CKEDITOR.tools.enableHtml5Elements( document );
|
||||
}
|
||||
|
||||
var editorElement = CKEDITOR.document.getById( '[0]' );
|
||||
editorElement.setAttribute( 'contenteditable', 'true' );
|
||||
|
||||
|
||||
CKEDITOR.inline( '[0]',
|
||||
{
|
||||
filebrowserBrowseUrl: '[doc_base_url][dir]ls?ckeditor_browse&fullscreen',
|
||||
customConfig : '[doc_base_url]/var/ckeditor_winix.js',
|
||||
|
||||
extraPlugins : 'sourcedialog',
|
||||
removePlugins : 'sourcearea',
|
||||
|
||||
toolbar : 'winix',
|
||||
height : '350px',
|
||||
scayt_autoStartup : false, // spellchecker disabled
|
||||
//docType : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
docType : '<!DOCTYPE html>',
|
||||
entities : false, // when true then ó becames ó,
|
||||
|
||||
toolbar_winix :
|
||||
\[
|
||||
\['Bold','Italic','Underline','Strike','-','Subscript','Superscript'\],
|
||||
\['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'\],
|
||||
\['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-'\],
|
||||
\],
|
||||
|
||||
|
||||
contentsCss : \[[for doc_css_tab]'[if not doc_css_tab_file_is_global][doc_base_url_static][end][doc_css_tab_file]'[if doc_css_tab_has_next], [end][end]\],
|
||||
|
||||
//config.skin : 'office2003',
|
||||
|
||||
coreStyles_strike :
|
||||
{
|
||||
element : 'del',
|
||||
overrides : 'strike'
|
||||
},
|
||||
|
||||
coreStyles_underline :
|
||||
{
|
||||
element : 'span',
|
||||
attributes : { 'class' : 'underline' }
|
||||
},
|
||||
|
||||
//config.allowedContent : true, // allowes all
|
||||
disallowedContent : 'p(western)', // from copying from Office
|
||||
extraAllowedContent : 'aside caption figure figcaption article footer header section (*); ul(*); h1(*); h2(*); p(*)'
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[end]
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
[if item_is]<h1>{edit}</h1>[else]<h1>{add}</h1>[end]
|
||||
|
||||
|
||||
<form id="additem" method="post" action="[doc_base_url][dir][if item_is][item_url]/[end]ckeditor">
|
||||
|
||||
[if mount_type_is "cms"]
|
||||
<div class="winix_input_a">
|
||||
<label for="winix_title_id">{title}:</label>
|
||||
|
@ -37,20 +34,13 @@
|
|||
[# template fun_ls.html uses the name: itemcontent to refer to this textarea item]
|
||||
|
||||
|
||||
<div id="editor">[item_content_noescape]</div>
|
||||
<div style="border-top: 1px solid #dadada; border-bottom: 1px solid #dadada; padding: 0.2em 0 0.2em 0; margin: 1em 0 1em 0;" id="winix-editor-content" data-winix-post-name="itemcontent">[item_print_content]</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="contenttype" value="2">
|
||||
<input id="contenttype" type="hidden" name="contenttype" value="2">
|
||||
|
||||
<!--
|
||||
[if winix_function_param_is "full"]
|
||||
<script type="text/javascript">CKEDITOR.replace('itemcontent', \{filebrowserUploadUrl: '[doc_base_url][dir]upload?noredirect&ckeditor_upload', filebrowserBrowseUrl: '[doc_base_url][dir]ls?ckeditor_browse&fullscreen', customConfig : '[doc_base_url]/var/ckeditor_full.js' \});</script>
|
||||
[else]
|
||||
<script type="text/javascript">CKEDITOR.replace('itemcontent', \{filebrowserUploadUrl: '[doc_base_url][dir]upload?noredirect&ckeditor_upload', filebrowserBrowseUrl: '[doc_base_url][dir]ls?ckeditor_browse&fullscreen', customConfig : '[doc_base_url]/var/ckeditor_winix.js' \});</script>
|
||||
-->
|
||||
[end]
|
||||
|
||||
[if not user_logged]
|
||||
<div class="winix_input_a">
|
||||
|
@ -64,57 +54,36 @@
|
|||
</div>
|
||||
[end]
|
||||
|
||||
<input type="submit" value="[if item_is]{change}[else]{add}[end]">
|
||||
|
||||
<div class="winix-update-button-container">
|
||||
<button class="winix_update_button" data-winix-function-path="[doc_base_url][dir][if item_is][item_url]/[end]ckeditor"
|
||||
data-winix-content-ckeditor-instances="winix-editor-content"
|
||||
data-winix-content-inputs="winix_url_id,winix_title_id,contenttype"
|
||||
data-winix-progressbar-id="winix-editor-progressbar"
|
||||
data-winix-messages-status-success-id="winix-editor-messages-status-success"
|
||||
data-winix-messages-status-error-id="winix-editor-messages-status-error"
|
||||
>
|
||||
Aktualizuj
|
||||
</button>
|
||||
|
||||
<div id="winix-editor-progressbar" class="winix-progressbar">
|
||||
<img src="[doc_base_url_common]/progressbars/progressbar_fading_lines_16x16.gif" alt="progress bar">
|
||||
</div>
|
||||
|
||||
<div id="winix-editor-messages-status-success" class="winix-editor-messages-status-success">
|
||||
</div>
|
||||
|
||||
<div id="winix-editor-messages-status-error" class="winix-editor-messages-status-error">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
||||
*/
|
||||
|
||||
/* exported initSample */
|
||||
|
||||
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
|
||||
CKEDITOR.tools.enableHtml5Elements( document );
|
||||
|
||||
// The trick to keep the editor in the sample quite small
|
||||
// unless user specified own height.
|
||||
CKEDITOR.config.height = 150;
|
||||
CKEDITOR.config.width = 'auto';
|
||||
|
||||
var initSample = ( function() \{
|
||||
var isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
|
||||
|
||||
return function() \{
|
||||
var editorElement = CKEDITOR.document.getById( 'editor' );
|
||||
|
||||
// :(((
|
||||
if ( isBBCodeBuiltIn ) \{
|
||||
editorElement.setHtml(
|
||||
'Hello world!\n\n' +
|
||||
'I\'m an instance of \[url=https://ckeditor.com\]CKEditor\[/url\].'
|
||||
);
|
||||
\}
|
||||
|
||||
editorElement.setAttribute( 'contenteditable', 'true' );
|
||||
CKEDITOR.inline( 'editor', \{ filebrowserBrowseUrl: '[doc_base_url][dir]ls?ckeditor_browse&fullscreen', customConfig : '[doc_base_url]/var/ckeditor_winix.js' \} );
|
||||
|
||||
// \}
|
||||
\};
|
||||
|
||||
\} )();
|
||||
|
||||
initSample();
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
[include "ckeditor.html"]
|
||||
[ckeditor_old_browsers_support]
|
||||
[ckeditor "winix-editor-content"]
|
||||
|
||||
</div>
|
||||
|
|
|
@ -136,6 +136,8 @@ cm.save()
|
|||
|
||||
[if winix_function_is "ckeditor"]
|
||||
<script type="text/javascript" src="[doc_base_url_common]/ckeditor_4.9.2/ckeditor.js"></script>
|
||||
<script type="text/javascript" src="[doc_base_url_common]/jquery-1.9.1.min.js"></script>
|
||||
<script type="text/javascript" src="[doc_base_url_common]/winix/update_button.js"></script>
|
||||
[end]
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2016, Tomasz Sowa
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -432,6 +432,11 @@ void item_meta(Info & i)
|
|||
}
|
||||
|
||||
|
||||
void item_meta_noescape(Info & i)
|
||||
{
|
||||
space_value(i, cur->request->last_item->meta, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void item_meta_tab(Info & i)
|
||||
|
@ -859,6 +864,11 @@ void item_tab_meta(Info & i)
|
|||
space_value(i, cur->request->item_tab[item_index].meta);
|
||||
}
|
||||
|
||||
void item_tab_meta_noescape(Info & i)
|
||||
{
|
||||
if( item_index < cur->request->item_tab.size() )
|
||||
space_value(i, cur->request->item_tab[item_index].meta, false);
|
||||
}
|
||||
|
||||
void item_tab_meta_tab(Info & i)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2016, Tomasz Sowa
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -459,6 +459,7 @@ void Templates::CreateFunctions()
|
|||
ezc_functions.Insert("item_sort", item_sort);
|
||||
ezc_functions.Insert("item_meta_str", item_meta_str);
|
||||
ezc_functions.Insert("item_meta", item_meta);
|
||||
ezc_functions.Insert("item_meta_noescape", item_meta_noescape);
|
||||
ezc_functions.Insert("item_meta_tab", item_meta_tab);
|
||||
ezc_functions.Insert("item_meta_tab_value", item_meta_tab_value);
|
||||
ezc_functions.Insert("item_meta_tab_has_next", item_meta_tab_has_next);
|
||||
|
@ -509,6 +510,7 @@ void Templates::CreateFunctions()
|
|||
ezc_functions.Insert("item_tab_has_next", item_tab_has_next);
|
||||
ezc_functions.Insert("item_tab_meta_str", item_tab_meta_str);
|
||||
ezc_functions.Insert("item_tab_meta", item_tab_meta);
|
||||
ezc_functions.Insert("item_tab_meta_noescape", item_tab_meta_noescape);
|
||||
ezc_functions.Insert("item_tab_meta_tab", item_tab_meta_tab);
|
||||
ezc_functions.Insert("item_tab_meta_tab_value", item_tab_meta_tab_value);
|
||||
ezc_functions.Insert("item_tab_meta_tab_has_next", item_tab_meta_tab_has_next);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2016, Tomasz Sowa
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -352,6 +352,7 @@ namespace TemplatesFunctions
|
|||
void item_sort(Info & i);
|
||||
void item_meta_str(Info & i);
|
||||
void item_meta(Info & i);
|
||||
void item_meta_noescape(Info & i);
|
||||
void item_meta_tab(Info & i);
|
||||
void item_meta_tab_value(Info & i);
|
||||
void item_meta_tab_has_next(Info & i);
|
||||
|
@ -402,6 +403,7 @@ namespace TemplatesFunctions
|
|||
void item_tab_has_next(Info & i);
|
||||
void item_tab_meta_str(Info & i);
|
||||
void item_tab_meta(Info & i);
|
||||
void item_tab_meta_noescape(Info & i);
|
||||
void item_tab_meta_tab(Info & i);
|
||||
void item_tab_meta_tab_value(Info & i);
|
||||
void item_tab_meta_tab_has_next(Info & i);
|
||||
|
|
Loading…
Reference in New Issue