Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alain Takoudjou
erp5
Commits
538ce729
Commit
538ce729
authored
Jan 27, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Ace javascript editor.
parent
07600f14
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
386 additions
and
1 deletion
+386
-1
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor.xml
..._editor/SkinTemplateItem/portal_skins/erp5_ace_editor.xml
+26
-0
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace.xml
...tor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace.xml
+26
-0
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace/ace.js.xml
...nTemplateItem/portal_skins/erp5_ace_editor/ace/ace.js.xml
+111
-0
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace/mode-python.js.xml
...eItem/portal_skins/erp5_ace_editor/ace/mode-python.js.xml
+44
-0
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace_editor_support.xml
...eItem/portal_skins/erp5_ace_editor/ace_editor_support.xml
+156
-0
bt5/erp5_ace_editor/bt/change_log
bt5/erp5_ace_editor/bt/change_log
+2
-0
bt5/erp5_ace_editor/bt/comment
bt5/erp5_ace_editor/bt/comment
+2
-0
bt5/erp5_ace_editor/bt/copyright_list
bt5/erp5_ace_editor/bt/copyright_list
+3
-0
bt5/erp5_ace_editor/bt/description
bt5/erp5_ace_editor/bt/description
+1
-0
bt5/erp5_ace_editor/bt/license
bt5/erp5_ace_editor/bt/license
+1
-0
bt5/erp5_ace_editor/bt/maintainer_list
bt5/erp5_ace_editor/bt/maintainer_list
+1
-0
bt5/erp5_ace_editor/bt/revision
bt5/erp5_ace_editor/bt/revision
+1
-0
bt5/erp5_ace_editor/bt/template_format_version
bt5/erp5_ace_editor/bt/template_format_version
+1
-0
bt5/erp5_ace_editor/bt/template_skin_id_list
bt5/erp5_ace_editor/bt/template_skin_id_list
+1
-0
bt5/erp5_ace_editor/bt/title
bt5/erp5_ace_editor/bt/title
+1
-0
product/ERP5Form/EditorField.py
product/ERP5Form/EditorField.py
+9
-1
No files found.
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor.xml
0 → 100644
View file @
538ce729
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Folder"
module=
"OFS.Folder"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
erp5_ace_editor
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Ace Javascript editor
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace.xml
0 → 100644
View file @
538ce729
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Folder"
module=
"OFS.Folder"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ace
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Source Code
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace/ace.js.xml
0 → 100644
View file @
538ce729
This source diff could not be displayed because it is too large. You can
view the blob
instead.
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace/mode-python.js.xml
0 → 100644
View file @
538ce729
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts27557245.52
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
mode-python.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/javascript
</string>
</value>
</item>
<item>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
define("ace/mode/python",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/python_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\\{\\(\\[\\:]\\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/python_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\\\d+)",m="(?:\\\\.\\\\d+)",n="(?:\\\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+\'"{3}(?:[^\\\\\\\\]|\\\\\\\\.)*?"{3}\'},{token:"string",merge:!0,regex:f+\'"{3}.*$\',next:"qqstring"},{token:"string",regex:f+\'"(?:[^\\\\\\\\]|\\\\\\\\.)*?"\'},{token:"string",regex:f+"\'{3}(?:[^\\\\\\\\]|\\\\\\\\.)*?\'{3}"},{token:"string",merge:!0,regex:f+"\'{3}.*$",next:"qstring"},{token:"string",regex:f+"\'(?:[^\\\\\\\\]|\\\\\\\\.)*?\'"},{token:"constant.numeric",regex:"(?:"+q+"|\\\\d+)[jJ]\\\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\\\b"},{token:"constant.numeric",regex:k+"\\\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b"},{token:"keyword.operator",regex:"\\\\+|\\\\-|\\\\*|\\\\*\\\\*|\\\\/|\\\\/\\\\/|%|<<|>
>|
&|\\\\||\\\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\\\[\\\\(\\\\{]"},{token:"rparen",regex:"[\\\\]\\\\)\\\\}]"},{token:"text",regex:"\\\\s+"}],qqstring:[{token:"string",regex:\'(?:[^\\\\\\\\]|\\\\\\\\.)*?"{3}\',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\\\\\]|\\\\\\\\.)*?\'{3}",next:"start"},{token:"string",merge:!0,regex:".+"}]}};
d.inherits(g,f),b.PythonHighlightRules=g}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\\s+$/.test(a)?/^\\s*\\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\\s*\\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e})
]]>
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
4511
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace_editor_support.xml
0 → 100644
View file @
538ce729
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
<tal:block tal:define=\'site_root python: here.getWebSiteValue() or here.getPortalObject();\n
portal_url python: site_root.absolute_url();\n
div_id string:${id}_ace;\n
container_div_id string:${div_id}_container;\n
\'>
\n
<style
type=
"text/css"
>
\n
.ace_scroller {\n
overflow-x: auto !important;\n
}\n
\n
.ace_sb {\n
overflow-y: auto !important;\n
}\n
\n
.ace_gutter {\n
background-color: #97B0D1 !important;\n
}\n
\n
.ace_content {\n
background-color: white !important;\n
}\n
\n
.ace_layer {\n
background-color: transparent !important;\n
}\n
\n
.field label {\n
width: 20% !important;\n
}\n
\n
.ace_line {\n
color: black !important;\n
}\n
</style>
\n
\n
<style
type=
"text/css"
tal:content=
"structure string:\n
#${div_id} * {\n
font-family: monospace !important;\n
}"
>
\n
</style>
\n
\n
<textarea
tal:attributes=
"id id; name id"
tal:content=
"content"
\n
style=
"display: none;"
></textarea>
\n
\n
<div
tal:attributes=
"id string:${container_div_id}"
\n
style=
"width: 200px; height: 200px;\n
border: 1px solid #97B0D1; background-color: white !important;"
>
\n
<div
style=
"position: relative !important; width: 100%; height: 100%;"
\n
tal:content=
"content"
\n
tal:attributes=
"id div_id"
></div>
\n
</div>
\n
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src string:${portal_url}/ace/ace.js"
></script>
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src string:${portal_url}/ace/mode-python.js"
></script>
\n
<script
type=
"text/javascript"
\n
tal:content=
"structure string:\n
window.onload = function() {\n
var container = $(\'#${container_div_id}\');\n
function set_container_size(event) {\n
width = $(window).innerWidth() - container.offset().left - 50;\n
if(width < 200)\n
width = 200;\n
container.width(width);\n
\n
height = $(window).innerHeight() - container.offset().top - 50;\n
if(height < 200)\n
height = 200;\n
container.height(height);\n
\n
if(event != null)\n
editor.resize();\n
}\n
\n
set_container_size(null);\n
window.onresize = set_container_size;\n
\n
var editor = ace.edit(\'${div_id}\');\n
editor.resize();\n
\n
var PythonMode = require(\'ace/mode/python\').Mode;\n
editor.getSession().setMode(new PythonMode());\n
\n
var textarea = $(\'#${id}\');\n
editor.getSession().on(\'change\', function() {\n
textarea.val(editor.getSession().getValue());\n
});\n
};"
>
\n
</script>
\n
</tal:block>
]]>
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ace_editor_support
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ace_editor/bt/change_log
0 → 100644
View file @
538ce729
2012-01-25 arnaud.fontaine
* Initial release.
\ No newline at end of file
bt5/erp5_ace_editor/bt/comment
0 → 100644
View file @
538ce729
Ace is available there:
http://ace.ajax.org/
\ No newline at end of file
bt5/erp5_ace_editor/bt/copyright_list
0 → 100644
View file @
538ce729
Copyright © 2009-2012 Ajax.org B.V.
Copyright © 2009-2012 the Initial Developer
Copyright © 2012 Nexedi SA
\ No newline at end of file
bt5/erp5_ace_editor/bt/description
0 → 100644
View file @
538ce729
This Business Template contains static files of Ace Javascript editor version 0.2.0.
\ No newline at end of file
bt5/erp5_ace_editor/bt/license
0 → 100644
View file @
538ce729
GPL
\ No newline at end of file
bt5/erp5_ace_editor/bt/maintainer_list
0 → 100644
View file @
538ce729
arnaud.fontaine
\ No newline at end of file
bt5/erp5_ace_editor/bt/revision
0 → 100644
View file @
538ce729
1
\ No newline at end of file
bt5/erp5_ace_editor/bt/template_format_version
0 → 100644
View file @
538ce729
1
\ No newline at end of file
bt5/erp5_ace_editor/bt/template_skin_id_list
0 → 100644
View file @
538ce729
erp5_ace_editor
\ No newline at end of file
bt5/erp5_ace_editor/bt/title
0 → 100644
View file @
538ce729
erp5_ace_editor
\ No newline at end of file
product/ERP5Form/EditorField.py
View file @
538ce729
...
...
@@ -74,7 +74,8 @@ class EditorWidget(Widget.TextAreaWidget):
(
'Bespin Editor'
,
'bespin'
),
(
'Xinha Editor'
,
'xinha'
),
(
'SVG Editor'
,
'svg_editor'
),
(
'Spreadsheet Editor'
,
'spreadsheet_editor'
)])
(
'Spreadsheet Editor'
,
'spreadsheet_editor'
),
(
'Ace Editor'
,
'ace'
)])
def
render
(
self
,
field
,
key
,
value
,
REQUEST
,
render_prefix
=
None
):
"""
...
...
@@ -117,6 +118,13 @@ class EditorWidget(Widget.TextAreaWidget):
if
sheet_editor_support
is
None
:
return
Widget
.
TextAreaWidget
.
render
(
self
,
field
,
key
,
value
,
REQUEST
)
return
sheet_editor_support
.
pt_render
()
elif
text_editor
==
'ace'
:
ace_editor_support
=
getattr
(
here
,
'ace_editor_support'
,
None
)
if
ace_editor_support
is
None
:
return
Widget
.
TextAreaWidth
.
render
(
self
,
field
,
key
,
value
,
REQUEST
)
return
ace_editor_support
.
pt_render
(
extra_context
=
{
'field'
:
field
,
'content'
:
value
,
'id'
:
key
})
else
:
return
here
.
fckeditor_wysiwyg_support
.
pt_render
(
extra_context
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment