Commit 8a4d772e authored by Martin's avatar Martin

Import trac-wysiwyg_0.12.0.3+r10725.orig.tar.gz

parents
include tracwysiwyg/htdocs/*.js
include tracwysiwyg/htdocs/*.css
include tracwysiwyg/htdocs/*.png
/*
* javascript:(function(d,u){var s=d.createElement('script');s.charset='utf-8';s.src=u;d.getElementsByTagName('head')[0].appendChild(s)})(document,'http://trac-hacks.org/svn/tracwysiwygplugin/0.10/bookmarklet.js')
*/
(function() {
var w = window;
var d = document;
var base = 'http://trac-hacks.org/svn/tracwysiwygplugin/0.10/tracwysiwyg/htdocs/';
var head = d.getElementsByTagName('head')[0];
var script = d.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('charset', 'utf-8');
script.src = base + 'wysiwyg.js';
head.appendChild(script);
var link = d.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', base + 'wysiwyg.css');
head.appendChild(link);
function getTracPaths() {
var paths = { stylesheets: [] };
var links = head.getElementsByTagName('link');
var length = links.length;
for (var i = 0; i < length; i++) {
var link = links[i];
var rel = (link.getAttribute('rel') || '').toLowerCase();
var type = (link.getAttribute('type') || '').toLowerCase();
var href = link.getAttribute('href') || '';
switch (rel) {
case 'help':
if (!paths.base && /\/wiki\/TracGuide$/.test(href)) {
paths.base = href.slice(0, -14);
}
break;
case 'search':
if (!paths.search && !type && /\/search$/.test(href)) {
paths.search = href;
paths.base = href.slice(0, -6);
}
break;
case 'stylesheet':
if (/\/css\/trac\.css$/.test(href)) {
paths.stylesheets.push(href);
}
break;
}
}
if (paths.base && paths.stylesheets.length > 0) {
if (!paths.search) {
paths.search = paths.base + 'search';
}
paths.stylesheets.push(base + 'editor.css');
return paths;
}
return null;
}
function lazy() {
switch (typeof w.TracWysiwyg) {
case 'undefined':
setTimeout(lazy, 100);
return;
case 'function':
TracWysiwyg.getTracPaths = getTracPaths;
TracWysiwyg.initialize();
break;
}
}
lazy();
})();
[egg_info]
tag_svn_revision = true
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name = 'TracWysiwyg',
version = '0.10.0.3',
description = 'TracWiki WYSIWYG Editor',
license = 'BSD',
url = 'http://trac-hacks.org/wiki/TracWysiwygPlugin',
author = 'Jun Omae',
author_email = 'omae@opengroove.com',
packages = find_packages(exclude=['*.tests*']),
package_data = {
'tracwysiwyg' : [ 'htdocs/*.js', 'htdocs/*.css', 'htdocs/*.png' ],
},
entry_points = {
'trac.plugins': [
'tracwysiwyg = tracwysiwyg',
],
}
)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>tracwysiwyg test</title>
<link rel="stylesheet" href="./chrome/common/css/trac.css" type="text/css" />
<link rel="stylesheet" href="../tracwysiwyg/htdocs/wysiwyg.css" type="text/css" />
<script type="text/javascript" src="./trac.js"></script>
<script type="text/javascript" src="../tracwysiwyg/htdocs/wysiwyg.js"></script>
<script type="text/javascript" src="./testunit.js"></script>
<script type="text/javascript" src="./testcase.js"></script>
<style type="text/css">
html { font-size: 13px; *font-size: small; }
body { font-family: Arial, Helvetica, sans-serif; font-size: 100%; }
textarea { font-size: 11px; width: 100%; border: 1px solid #999; }
#testunit .current { background-color: #FFFF80; }
#testunit .success { background-color: #33dd88; }
#testunit .failure textarea { background-color: #ff3333; border-style: none; }
#wysiwyg-html {
width: 100%;
border: 1px solid #999;
font-size: 11px;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
</head>
<body>
<form method="post">
<textarea id="textarea" class="wikitext" cols="50" rows="20" wrap="off"></textarea>
<div>
<label><input type="checkbox" id="show-wysiwyg-html" value="1"
onclick="document.getElementById('wysiwyg-html').style.display=this.checked?'':'none'"
/>show html</label>
<textarea id="wysiwyg-html" cols="50" rows="12" style="display:none;"></textarea>
</div>
</form>
</body>
</html>
This diff is collapsed.
TracWysiwyg.TestUnit = function() {
this.cases = {};
this.assertCounts = {};
this.current = null;
};
(function() {
var prototype = TracWysiwyg.TestUnit.prototype;
prototype.inspect = function(value) {
var type = typeof value;
switch (type) {
case "string":
return value.replace(/[\u0000-\u001f\\\u007f\ufffe\uffff]/g, function(m) {
var code = m.charCodeAt(0);
switch (code) {
case 9: return "\\t";
case 10: return "\\n";
case 11: return "\\v";
case 12: return "\\f";
case 13: return "\\r";
case 92: return "\\\\";
}
return "\\u" + (0x10000 + code).toString(16).substring(1);
});
break;
case "object":
case "function":
if (value instanceof RegExp) {
return value.toString();
}
}
return "{%}".replace("%", type) + value.toString();
};
prototype.fragment = function() {
var start = 0;
var arg = arguments[0];
var d;
if (arg.nodeType != 9) {
d = document;
}
else {
d = arg;
start = 1;
}
var fragment = d.createDocumentFragment();
var length = arguments.length;
for (var i = start; i < length; i++) {
fragment.appendChild(arguments[i]);
}
return fragment;
};
prototype.element = function(tag) {
var start = 0;
var arg = arguments[start++];
var d, tag;
if (typeof arg == "string") {
d = document;
tag = arg;
}
else {
d = arg;
tag = arguments[start++];
}
var element = d.createElement(tag);
for (var i = start; i < arguments.length; i++) {
arg = arguments[i];
switch (typeof arg) {
case "object":
if (typeof arg.nodeType == "undefined") {
for (var name in arg) {
var value = arg[name];
switch (name) {
case "id":
element.id = value;
break;
case "class": case "className":
element.className = value;
break;
default:
element.setAttribute(name, value);
break;
}
}
continue;
}
break;
case "string":
arg = d.createTextNode(arg);
break;
}
element.appendChild(arg);
}
return element;
};
prototype.text = function() {
var start = 0;
var arg = arguments[start++];
var d, text;
if (typeof arg == "string") {
d = document;
text = arg;
}
else {
d = arg;
text = arguments[start++];
}
return d.createTextNode(text);
};
prototype.$ = function(id) {
return typeof id == "string" ? document.getElementById(id) : id;
};
prototype.add = function(name, method) {
if (name in this.cases) {
throw "'" + name + "' is in use.";
}
this.cases[name] = method;
this.assertCounts[name] = 0;
};
prototype.assertEqual = function(expected, actual, label) {
var count = ++this.assertCounts[this.current];
if (typeof (expected) == typeof (actual) && expected == actual) {
return true;
}
throw (label || "") + "[" + count + "]\n"
+ this.inspect(expected) + " (" + expected.length + ")\n"
+ this.inspect(actual) + " (" + actual.length + ")";
};
prototype.assertMatch = function(pattern, string, label) {
var count = ++this.assertCounts[this.current];
if (pattern.test(string)) {
return true;
}
throw (label || "") + "[" + count + "]\n"
+ this.inspect(pattern) + "\n"
+ this.inspect(string) + " (" + string.length + ")";
};
prototype.run = function() {
var self = this
var $ = this.$, element = this.element, text = this.text;
var d = document;
var cases = this.cases;
var assertCounts = this.assertCounts;
var names = [];
for (var name in cases) {
names.push(name);
assertCounts[name] = 0;
}
var container = $("testunit");
var count;
if (container) {
container.parentNode.removeChild(container);
}
container = element(
"table", { id: "testunit" },
element("caption", { id: "testunit.summary" }),
element("tbody", { id: "testunit.body" }));
d.body.appendChild(container);
var body = $("testunit.body");
var summary = $("testunit.summary");
for (count = 0; count < names.length; count++) {
body.appendChild(
element("tr",
element("td", names[count]),
element("td", { id: "testcase." + count }, "...")));
}
count = 0;
var success = 0;
var invoke = function() {
if (count >= names.length) {
self.current = null;
return;
}
var current = names[count];
self.current = current;
var cell = $("testcase." + count);
cell.className = "current";
try {
cases[current].call(self);
cell.className = "success";
cell.replaceChild(text("OK"), cell.firstChild);
success++;
}
catch (e) {
cell.className = "failure";
var message = e.message || e.toString();
if (e.stack) {
message = [ message, e.stack ].join("\n\n");
}
cell.replaceChild(
element("textarea", { id: "testcase." + count + ".textarea",
rows: message.split("\n").length,
cols: 80,
readonly: "readonly" }),
cell.firstChild);
$("testcase." + count + ".textarea").value = message;
}
summary.innerHTML = success + " / " + names.length;
count++;
setTimeout(invoke, 10);
};
invoke();
};
})();
function addEvent(element, type, listener) {
if (element.addEventListener) {
element.addEventListener(type, listener, false);
return true;
}
else if (element.attachEvent) {
return element.attachEvent("on" + type, listener);
}
return false;
}
function getAncestorByTagName(node, tag) {
tag = tag.toLowerCase();
do {
node = node.parentNode;
} while (node.nodeType == 1 && node.tagName.toLowerCase() != tag);
return node.nodeType == 1 ? node : null;
}
# -*- coding: utf-8 -*-
import re
from trac.core import Component, implements
from trac.config import ListOption
from trac.web.api import IRequestFilter
from trac.web.chrome import ITemplateProvider, add_link, add_stylesheet, add_script
from trac.web.href import Href
from trac.util.html import Markup
__all__ = ['WysiwygModule']
class WysiwygModule(Component):
implements(ITemplateProvider, IRequestFilter)
wysiwyg_stylesheets = ListOption('tracwysiwyg', 'wysiwyg_stylesheets',
doc="""Add stylesheets to the WYSIWYG editor""")
# ITemplateProvider#get_htdocs_dirs
def get_htdocs_dirs(self):
from pkg_resources import resource_filename
return [('tracwysiwyg', resource_filename(__name__, 'htdocs'))]
# ITemplateProvider#get_templates_dirs
def get_templates_dirs(self):
return []
# IRequestFilter#pre_process_request
def pre_process_request(self, req, handler):
return handler
# IRequestFilter#post_process_request
def post_process_request(self, req, template, content_type):
add_link(req, 'tracwysiwyg-base', req.href() or '/')
stylesheets = ['chrome/common/css/trac.css', 'chrome/tracwysiwyg/editor.css']
stylesheets += self.wysiwyg_stylesheets
for stylesheet in stylesheets:
add_link(req, 'tracwysiwyg-stylesheet', _expand_filename(req, stylesheet))
add_stylesheet(req, 'tracwysiwyg/wysiwyg.css')
add_script(req, 'tracwysiwyg/wysiwyg.js')
footer = req.hdf['project.footer'] + '<script type="text/javascript">TracWysiwyg.initialize();</script>'
req.hdf['project.footer'] = Markup(footer)
return (template, content_type)
def _expand_filename(req, filename):
if filename.startswith('chrome/common/') and 'htdocs_location' in req.hdf:
href = Href(req.hdf['htdocs_location'])
return href(filename[14:])
if filename.startswith('/') or re.match(r'https?://', filename):
href = Href(filename)
return href()
return req.href(filename)
pre.wiki {
overflow: visible !important;
word-wrap: break-word !important;
white-space: -moz-pre-wrap !important;
white-space: pre-wrap !important;
}
iframe.wysiwyg {
border: 1px solid #d7d7d7;
clear: both;
display: block;
}
iframe.wysiwyg:focus {
border: 1px solid #886;
}
.editor-toggle {
float: right;
font-size: 80%;
}
.wysiwyg-toolbar {
border: solid #d7d7d7;
border-width: 1px 1px 1px 0;
height: 18px;
width: 400px;
float: left;
}
.wysiwyg-toolbar ul, .wysiwyg-toolbar li {
list-style-type: none;
margin: 0px;
padding: 0px;
}
.wysiwyg-toolbar li {
float: left;
display: block;
}
.wysiwyg-toolbar li :link, .wysiwyg-toolbar li :visited {
background: transparent url(toolbar.png) no-repeat;
border: 1px solid #fff;
border-left-color: #d7d7d7;
cursor: default;
display: block;
width: 20px;
height: 16px;
color: #777;
}
.wysiwyg-toolbar li.selected :link, .wysiwyg-toolbar li.selected :visited {
border: 1px solid #7c4;
}
.wysiwyg-toolbar li a:hover, .wysiwyg-toolbar li.selected a:hover {
background-color: transparent;
border: 1px solid #fb2;
color: #886;
}
.wysiwyg-toolbar li a#wt-style {
width: 62px;
white-space: nowrap;
overflow-x: hidden;
line-height: 1.2;
padding-left: 2px;
padding-right: 2px;
background-image: url(../common/desc.png);
background-position: right bottom;
}
.wysiwyg-toolbar li a#wt-style span {
display: none;
}
.wysiwyg-toolbar li.wysiwyg-menu-style a#wt-style span.wysiwyg-menu-style { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-paragraph a#wt-style span.wysiwyg-menu-paragraph { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-heading1 a#wt-style span.wysiwyg-menu-heading1 { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-heading2 a#wt-style span.wysiwyg-menu-heading2 { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-heading3 a#wt-style span.wysiwyg-menu-heading3 { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-heading4 a#wt-style span.wysiwyg-menu-heading4 { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-heading5 a#wt-style span.wysiwyg-menu-heading5 { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-heading6 a#wt-style span.wysiwyg-menu-heading6 { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-code a#wt-style span.wysiwyg-menu-code { display: inline; }
.wysiwyg-toolbar li.wysiwyg-menu-quote a#wt-style span.wysiwyg-menu-quote { display: inline; }
.wysiwyg-toolbar li a#wt-em { background-position: 0 0; }
.wysiwyg-toolbar li a#wt-strong { background-position: 0 -16px; }
.wysiwyg-toolbar li a#wt-underline { background-position: 0 -32px; }
.wysiwyg-toolbar li a#wt-monospace { background-position: 0 -160px; }
.wysiwyg-toolbar li a#wt-link { background-position: 0 -96px; }
.wysiwyg-toolbar li a#wt-unlink { background-position: 0 -112px; }
.wysiwyg-toolbar li a#wt-ol { background-position: 0 -176px; }
.wysiwyg-toolbar li a#wt-ul { background-position: 0 -192px; }
.wysiwyg-toolbar li a#wt-outdent { background-position: 0 -208px; }
.wysiwyg-toolbar li a#wt-indent { background-position: 0 -224px; }
.wysiwyg-toolbar li a#wt-table { background-position: 0 -240px; }
.wysiwyg-toolbar li a#wt-hr { background-position: 0 -128px; }
.wysiwyg-toolbar li a#wt-br { background-position: 0 -144px; }
.wysiwyg-toolbar li a#wt-remove { background-position: 0 -256px; }
.wysiwyg-toolbar li a#wt-decorationmenu,
.wysiwyg-toolbar li a#wt-tablemenu
{
width: 10px;
background-image: url(../common/desc.png);
background-position: center bottom;
}
.wysiwyg-menu {
border: 1px solid #d7d7d7;
padding: 1px 2px;
background-color: #fff;
-moz-opacity: 0.90;
opacity: 0.90;
}
.wysiwyg-menu p,
.wysiwyg-menu h1,
.wysiwyg-menu h2,
.wysiwyg-menu h3,
.wysiwyg-menu h4,
.wysiwyg-menu h5,
.wysiwyg-menu h6,
.wysiwyg-menu pre.wiki,
.wysiwyg-menu blockquote.citation
{
margin: 0px;
}
.wysiwyg-menu ul, .wysiwyg-menu li {
list-style-type: none;
margin: 0px;
padding: 0px;
}
.wysiwyg-menu :link, .wysiwyg-menu :visited {
display: block;
padding: 1px;
border: 1px solid #fff;
color: #000;
}
.wysiwyg-menu .selected :link, .wysiwyg-menu .selected :visited {
border: 1px solid #7c4;
}
.wysiwyg-menu a:hover, .wysiwyg-menu .selected a:hover {
border: 1px solid #fb2;
}
.wysiwyg-menu .menu {
font-size: 85%;
}
This diff is collapsed.
include tracwysiwyg/htdocs/*.js
include tracwysiwyg/htdocs/*.css
include tracwysiwyg/htdocs/*.png
/*
* javascript:(function(d,u){var s=d.createElement('script');s.charset='utf-8';s.src=u;d.getElementsByTagName('head')[0].appendChild(s)})(document,'http://trac-hacks.org/svn/tracwysiwygplugin/0.11/bookmarklet.js')
*/
(function() {
var w = window;
var d = document;
var base = 'http://trac-hacks.org/svn/tracwysiwygplugin/0.11/tracwysiwyg/htdocs/';
var head = d.getElementsByTagName('head')[0];
var script = d.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('charset', 'utf-8');
script.src = base + 'wysiwyg.js';
head.appendChild(script);
var link = d.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', base + 'wysiwyg.css');
head.appendChild(link);
function getTracPaths() {
var paths = { stylesheets: [] };
var links = head.getElementsByTagName('link');
var length = links.length;
for (var i = 0; i < length; i++) {
var link = links[i];
var rel = (link.getAttribute('rel') || '').toLowerCase();
var type = (link.getAttribute('type') || '').toLowerCase();
var href = link.getAttribute('href') || '';
switch (rel) {
case 'help':
if (!paths.base && /\/wiki\/TracGuide$/.test(href)) {
paths.base = href.slice(0, -14);
}
break;
case 'search':
if (!paths.search && !type && /\/search$/.test(href)) {
paths.search = href;
paths.base = href.slice(0, -6);
}
break;
case 'stylesheet':
if (/\/css\/trac\.css$/.test(href)) {
paths.stylesheets.push(href);
}
break;
}
}
if (paths.base && paths.stylesheets.length > 0) {
if (!paths.search) {
paths.search = paths.base + 'search';
}
paths.stylesheets.push(base + 'editor.css');
return paths;
}
return null;
}
function lazy() {
switch (typeof w.TracWysiwyg) {
case 'undefined':
setTimeout(lazy, 100);
return;
case 'function':
TracWysiwyg.getTracPaths = getTracPaths;
TracWysiwyg.initialize();
break;
}
}
lazy();
})();
[egg_info]
tag_svn_revision = true
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name = 'TracWysiwyg',
version = '0.11.0.3',
description = 'TracWiki WYSIWYG Editor',
license = 'BSD',
url = 'http://trac-hacks.org/wiki/TracWysiwygPlugin',
author = 'Jun Omae',
author_email = 'omae@opengroove.com',
packages = find_packages(exclude=['*.tests*']),
package_data = {
'tracwysiwyg' : [ 'htdocs/*.js', 'htdocs/*.css', 'htdocs/*.png' ],
},
entry_points = {
'trac.plugins': [
'tracwysiwyg = tracwysiwyg',
],
}
)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>tracwysiwyg test</title>