Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mig/images/lib/markitup
20 changes: 20 additions & 0 deletions mig/images/lib/markitup-1.1.15/MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16 changes: 16 additions & 0 deletions mig/images/lib/markitup-1.1.15/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

markItUp! Universal markup editor
=================================

markItUp! is a JavaScript plugin built on the jQuery library. It allows you to turn any textarea into a markup editor. Html, Textile, Wiki Syntax, Markdown, BBcode or even your own Markup system can be easily implemented.

markItUp! is not meant to be a “Full-Features-Out-of-the-Box”-editor. Instead it is a very lightweight, customizable and flexible engine made to meet the developer's needs in their CMSes, blogs, forums or websites. markItUp! is not a WYSIWYG editor, and it never will be.

**Home:**
[http://markitup.jaysalvat.com/](http://markitup.jaysalvat.com/)

**Documentation:**
[http://markitup.jaysalvat.com/documentation/](http://markitup.jaysalvat.com/documentation/)

**Examples:**
[http://markitup.jaysalvat.com/examples/](http://markitup.jaysalvat.com/examples/)
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
previewParser: false,
previewParserPath: '',
previewParserVar: 'data',
previewParserAjaxType: 'POST',
resizeHandle: true,
beforeInsert: '',
afterInsert: '',
Expand All @@ -59,7 +60,7 @@
// compute markItUp! path
if (!options.root) {
$('script').each(function(a, tag) {
miuScript = $(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);
var miuScript = $(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);
if (miuScript !== null) {
options.root = miuScript[1];
}
Expand Down Expand Up @@ -202,7 +203,7 @@
$('li:hover > ul', ul).css('display', 'block');
$.each(markupSet, function() {
var button = this, t = '', title, li, j;
title = (button.key) ? (button.name||'')+' [Ctrl+'+button.key+']' : (button.name||'');
button.title ? title = (button.key) ? (button.title||'')+' [Ctrl+'+button.key+']' : (button.title||'') : title = (button.key) ? (button.name||'')+' [Ctrl+'+button.key+']' : (button.name||'');
key = (button.key) ? 'accesskey="'+button.key+'"' : '';
if (button.separator) {
li = $('<li class="markItUpSeparator">'+(button.separator||'')+'</li>').appendTo(ul);
Expand All @@ -211,16 +212,16 @@
for (j = levels.length -1; j >= 0; j--) {
t += levels[j]+"-";
}
li = $('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>')
li = $('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="#" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>')
.bind("contextmenu.markItUp", function() { // prevent contextmenu on mac and allow ctrl+click
return false;
}).bind('click.markItUp', function(e) {
e.preventDefault();
}).bind("focusin.markItUp", function(){
$$.focus();
}).bind('mouseup', function() {
}).bind('mouseup', function(e) {
if (button.call) {
eval(button.call)();
eval(button.call)(e); // Pass the mouseup event to custom delegate
}
setTimeout(function() { markup(button) },1);
return false;
Expand Down Expand Up @@ -537,18 +538,19 @@

function renderPreview() {
var phtml;
var parsedData = $$.val();
if (options.previewParser && typeof options.previewParser === 'function') {
parsedData = options.previewParser(parsedData);
}
if (options.previewHandler && typeof options.previewHandler === 'function') {
options.previewHandler( $$.val() );
} else if (options.previewParser && typeof options.previewParser === 'function') {
var data = options.previewParser( $$.val() );
writeInPreview(localize(data, 1) );
options.previewHandler(parsedData);
} else if (options.previewParserPath !== '') {
$.ajax({
type: 'POST',
type: options.previewParserAjaxType,
dataType: 'text',
global: false,
url: options.previewParserPath,
data: options.previewParserVar+'='+encodeURIComponent($$.val()),
data: options.previewParserVar+'='+encodeURIComponent(parsedData),
success: function(data) {
writeInPreview( localize(data, 1) );
}
Expand All @@ -560,7 +562,7 @@
dataType: 'text',
global: false,
success: function(data) {
writeInPreview( localize(data, 1).replace(/<!-- content -->/g, $$.val()) );
writeInPreview( localize(data, 1).replace(/<!-- content -->/g, parsedData) );
}
});
}
Expand All @@ -570,7 +572,7 @@

function writeInPreview(data) {
if (options.previewInElement) {
$(options.previewInElement).html(data);

Check failure

Code scanning / CodeQL

DOM text reinterpreted as HTML High library

DOM text
is reinterpreted as HTML without escaping meta-characters.
DOM text
is reinterpreted as HTML without escaping meta-characters.
} else if (previewWindow && previewWindow.document) {
try {
sp = previewWindow.document.documentElement.scrollTop
Expand All @@ -578,7 +580,7 @@
sp = 0;
}
previewWindow.document.open();
previewWindow.document.write(data);

Check failure

Code scanning / CodeQL

DOM text reinterpreted as HTML High library

DOM text
is reinterpreted as HTML without escaping meta-characters.
DOM text
is reinterpreted as HTML without escaping meta-characters.
previewWindow.document.close();
previewWindow.document.documentElement.scrollTop = sp;
}
Expand Down Expand Up @@ -636,6 +638,12 @@
function remove() {
$$.unbind(".markItUp").removeClass('markItUpEditor');
$$.parent('div').parent('div.markItUp').parent('div').replaceWith($$);

var relativeRef = $$.parent('div').parent('div.markItUp').parent('div');
if (relativeRef.length) {
relativeRef.replaceWith($$);
}

$$.data('markItUp', null);
}

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/* -------------------------------------------------------------------
// markItUp!
// By Jay Salvat - http://markitup.jaysalvat.com/
// ------------------------------------------------------------------*/
.markItUp .markItUpButton1 a {
background-image:url(images/bold.png);
}
.markItUp .markItUpButton2 a {
background-image:url(images/italic.png);
}
.markItUp .markItUpButton3 a {
background-image:url(images/stroke.png);
}

.markItUp .markItUpButton4 a {
background-image:url(images/list-bullet.png);
}
.markItUp .markItUpButton5 a {
background-image:url(images/list-numeric.png);
}

.markItUp .markItUpButton6 a {
background-image:url(images/picture.png);
}
.markItUp .markItUpButton7 a {
background-image:url(images/link.png);
}

.markItUp .markItUpButton8 a {
background-image:url(images/clean.png);
}
.markItUp .preview a {
background-image:url(images/preview.png);
}
/* -------------------------------------------------------------------
// markItUp!
// By Jay Salvat - http://markitup.jaysalvat.com/
// ------------------------------------------------------------------*/
.markItUp .markItUpButton1 a {
background-image:url(images/bold.png);
}
.markItUp .markItUpButton2 a {
background-image:url(images/italic.png);
}
.markItUp .markItUpButton3 a {
background-image:url(images/stroke.png);
}
.markItUp .markItUpButton4 a {
background-image:url(images/list-bullet.png);
}
.markItUp .markItUpButton5 a {
background-image:url(images/list-numeric.png);
}
.markItUp .markItUpButton6 a {
background-image:url(images/picture.png);
}
.markItUp .markItUpButton7 a {
background-image:url(images/link.png);
}
.markItUp .markItUpButton8 a {
background-image:url(images/clean.png);
}
.markItUp .preview a {
background-image:url(images/preview.png);
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
5 changes: 5 additions & 0 deletions mig/images/lib/markitup-1.1.15/markitup/templates/preview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* preview style examples */
body {
background-color:#EFEFEF;
font:70% Verdana, Arial, Helvetica, sans-serif;
}
11 changes: 11 additions & 0 deletions mig/images/lib/markitup-1.1.15/markitup/templates/preview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>markItUp! preview template</title>
<link rel="stylesheet" type="text/css" href="~/templates/preview.css" />
</head>
<body>
<!-- content -->
</body>
</html>
27 changes: 27 additions & 0 deletions mig/images/lib/markitup-1.1.15/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "markItUp! ",
"title": "markItUp! universal markup jQuery editor",
"description": "markItUp! is a JavaScript plugin built on the jQuery library. It allows you to turn any textarea into a markup editor. Html, Textile, Wiki Syntax, Markdown, BBcode or even your own Markup system can be easily implemented.",
"version": "1.1.0",
"homepage": "http://markitup.jaysalvat.com/",
"author": {
"name": "Jay Salvat",
"email": "",
"url": "http://jaysalvat.com"
},
"repository": {
"type": "git",
"url": "https://github.com/markitup/1.x"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
},
{
"type": "GPL",
"url": "http://www.opensource.org/licenses/GPL-2.0"
}
],
"keywords": [ "jquery", "markup", "editor", "markdown", "wiki", "bbcode", "html", "textile" ]
}
10 changes: 9 additions & 1 deletion mig/shared/editing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
Expand All @@ -20,7 +20,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Check warning on line 23 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
#
# -- END_HEADER ---
#
Expand Down Expand Up @@ -53,11 +53,11 @@
cm_css = '''
<!-- CodeMirror style -->
<link rel="stylesheet" type="text/css" href="%s/codemirror.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="%s/dialog/dialog.css" media="screen"/>

Check warning on line 56 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)
<link rel="stylesheet" type="text/css" href="%s/fold/foldgutter.css" media="screen"/>

Check warning on line 57 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (85 > 80 characters)
<link rel="stylesheet" type="text/css" href="%s/codemirror-ui.css" media="screen"/>

Check warning on line 58 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)
<link rel="stylesheet" type="text/css" href="/images/css/codemirror.custom.css" media="screen"/>

Check warning on line 59 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (96 > 80 characters)
<link rel="stylesheet" type="text/css" href="/images/css/codemirror-ui.custom.css" media="screen"/>

Check warning on line 60 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (99 > 80 characters)
''' % (cm_css_prefix, cm_addon_prefix, cm_addon_prefix, cmui_css_prefix)
cm_javascript = '''
<!-- CodeMirror scripts -->
Expand Down Expand Up @@ -94,15 +94,23 @@

miu_css = '''
<!-- MarkItUp style -->
<link rel="stylesheet" type="text/css" href="/images/lib/markitup/markitup/skins/markitup/style.css"/>

Check warning on line 97 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (102 > 80 characters)
<!--
<link rel="stylesheet" type="text/css" href="/images/lib/markitup/markitup/sets/default/style.css" title="txt2tags"/>

Check warning on line 99 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (117 > 80 characters)
<link rel="stylesheet" type="text/css" href="/images/lib/markitup/markitup/sets/txt2tags/style.css" title="txt2tags"/>

Check warning on line 100 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (118 > 80 characters)
-->
<link rel="stylesheet" type="text/css" href="/images/lib/markitup/markitup/sets/html/style.css" title="html"/>

Check warning on line 102 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (110 > 80 characters)
'''
miu_javascript = '''
<!-- MarkItUp scripts -->
<script type="text/javascript" src="/images/lib/markitup/markitup/jquery.markitup.js"></script>
<!--
<script type="text/javascript" src="/images/lib/markitup/markitup/sets/default/set.js"></script>
<script type="text/javascript">
var myDefaultSettings = mySettings;
myDefaultSettings["nameSpace"] = "default";
</script>
-->
<script type="text/javascript" src="/images/lib/markitup/markitup/sets/html/set.js"></script>
<script type="text/javascript">
var myHtmlSettings = mySettings;
Expand All @@ -112,11 +120,11 @@
<script type="text/javascript" src="/images/lib/markitup/markitup/sets/txt2tags/set.js"></script>
<script type="text/javascript">
var myTxt2TagsSettings = mySettings;
myTxt2TagsSettings["nameSpace"] = "markitup-txt2tags";
myTxt2TagsSettings["nameSpace"] = "txt2tags";
</script>
-->
'''
miu_options = {}

Check failure on line 127 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'miu_options' (60% confidence)


def py_to_js(options):
Expand Down Expand Up @@ -175,7 +183,7 @@
return out


def run_editor_js(name, wrap_in_tags=True, mode=""):

Check failure on line 186 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'mode' (100% confidence)
"""Create javascript to actually wrap a previously initialized HTML
textarea in user friendly code editor with syntax highlighting and basic
toolbar.
Expand Down Expand Up @@ -222,8 +230,8 @@
return out


def wrap_edit_area(name, area, edit_opts=cm_options, toolbar_buttons='ALL',

Check failure on line 233 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'toolbar_buttons' (100% confidence)

Check failure on line 233 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused function 'wrap_edit_area' (60% confidence)
exec_callback=None):

Check failure on line 234 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'exec_callback' (100% confidence)
"""Wrap HTML textarea in user friendly code editor with syntax highlighting
and basic toolbar.
The area variable should contain a string with HTML form code to wrap.
Expand Down Expand Up @@ -357,7 +365,7 @@
return True


def release_edit_lock(real_path, client_id):

Check failure on line 368 in mig/shared/editing.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused function 'release_edit_lock' (60% confidence)
"""Try to release an acquired file editing lock. Check that owner
matches release caller.
"""
Expand Down
9 changes: 9 additions & 0 deletions mig/shared/functionality/editor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
Expand Down Expand Up @@ -39,7 +39,7 @@
from mig.shared import returnvalues
from mig.shared.base import client_id_dir
from mig.shared.defaults import csrf_field
from mig.shared.editing import acquire_edit_lock, edit_lock_suffix, cm_css, \

Check failure on line 42 in mig/shared/functionality/editor.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'miu_options' (90% confidence)
cm_javascript, cm_options, miu_css, miu_javascript, miu_options, \
init_editor_js, run_editor_js, change_editor_mode_js, kill_editor_js
from mig.shared.fileio import read_file
Expand Down Expand Up @@ -222,6 +222,7 @@
$("#editorarea").markItUpRemove();
/* stylesheet button settings collide for different sets
disable all set stylesheets and enable only selected one */
//disableStyleSheet("default");
disableStyleSheet("html");
//disableStyleSheet("txt2tags");
} else if (lastEdit == "CodeMirror") {
Expand All @@ -234,6 +235,13 @@
function enable_editorarea_editor(newSet) {
lastEdit = "raw";
switch(newSet) {
/*
case "default":
lastEdit = "MarkItUp";
enableStyleSheet("default");
$("#editorarea").markItUp(myDefaultSettings);
break;
*/
case "html":
lastEdit = "MarkItUp";
enableStyleSheet("html");
Expand Down Expand Up @@ -390,6 +398,7 @@
if 'switcher' in includes:
html += '''
<ul id="switcher">
<!--<li class="default"><a href="#">Text Editor</a></li>-->
<li class="html currentSet"><a href="#">HTML/Text Editor</a></li>
<li class="codemirror"><a href="#">Code Editor</a></li>
<!-- <li class="txt2tags"><a href="#">Txt2Tags Editor</a></li> -->
Expand Down Expand Up @@ -471,7 +480,7 @@
return html % fill_helpers


def main(client_id, user_arguments_dict):

Check failure on line 483 in mig/shared/functionality/editor.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused function 'main' (60% confidence)
"""Main function used by front end"""

(configuration, logger, output_objects, op_name) = \
Expand Down
Loading