Add htmlarea http://www.htmlarea.com/ tool to appdb

This commit is contained in:
WineHQ
2005-02-02 01:11:59 +00:00
parent da42397711
commit 6beff0b816
197 changed files with 15756 additions and 0 deletions

View File

@@ -0,0 +1,172 @@
// FullPage Plugin for HTMLArea-3.0
// Implementation by Mihai Bazon. Sponsored by http://thycotic.com
//
// (c) dynarch.com 2003-2005.
// Distributed under the same terms as HTMLArea itself.
// This notice MUST stay intact for use (see license.txt).
//
// $Id$
function FullPage(editor) {
this.editor = editor;
var cfg = editor.config;
cfg.fullPage = true;
var tt = FullPage.I18N;
var self = this;
cfg.registerButton("FP-docprop", tt["Document properties"], editor.imgURL("docprop.gif", "FullPage"), false,
function(editor, id) {
self.buttonPress(editor, id);
});
// add a new line in the toolbar
cfg.toolbar[0].splice(0, 0, "separator");
cfg.toolbar[0].splice(0, 0, "FP-docprop");
};
FullPage._pluginInfo = {
name : "FullPage",
version : "1.0",
developer : "Mihai Bazon",
developer_url : "http://dynarch.com/mishoo/",
c_owner : "Mihai Bazon",
sponsor : "Thycotic Software Ltd.",
sponsor_url : "http://thycotic.com",
license : "htmlArea"
};
FullPage.prototype.buttonPress = function(editor, id) {
var self = this;
switch (id) {
case "FP-docprop":
var doc = editor._doc;
var links = doc.getElementsByTagName("link");
var style1 = '';
var style2 = '';
var charset = '';
for (var i = links.length; --i >= 0;) {
var link = links[i];
if (/stylesheet/i.test(link.rel)) {
if (/alternate/i.test(link.rel))
style2 = link.href;
else
style1 = link.href;
}
}
var metas = doc.getElementsByTagName("meta");
for (var i = metas.length; --i >= 0;) {
var meta = metas[i];
if (/content-type/i.test(meta.httpEquiv)) {
r = /^text\/html; *charset=(.*)$/i.exec(meta.content);
charset = r[1];
}
}
var title = doc.getElementsByTagName("title")[0];
title = title ? title.innerHTML : '';
var init = {
f_doctype : editor.doctype,
f_title : title,
f_body_bgcolor : HTMLArea._colorToRgb(doc.body.style.backgroundColor),
f_body_fgcolor : HTMLArea._colorToRgb(doc.body.style.color),
f_base_style : style1,
f_alt_style : style2,
f_charset : charset,
editor : editor
};
editor._popupDialog("plugin://FullPage/docprop", function(params) {
self.setDocProp(params);
}, init);
break;
}
};
FullPage.prototype.setDocProp = function(params) {
var txt = "";
var doc = this.editor._doc;
var head = doc.getElementsByTagName("head")[0];
var links = doc.getElementsByTagName("link");
var metas = doc.getElementsByTagName("meta");
var style1 = null;
var style2 = null;
var charset = null;
var charset_meta = null;
for (var i = links.length; --i >= 0;) {
var link = links[i];
if (/stylesheet/i.test(link.rel)) {
if (/alternate/i.test(link.rel))
style2 = link;
else
style1 = link;
}
}
for (var i = metas.length; --i >= 0;) {
var meta = metas[i];
if (/content-type/i.test(meta.httpEquiv)) {
r = /^text\/html; *charset=(.*)$/i.exec(meta.content);
charset = r[1];
charset_meta = meta;
}
}
function createLink(alt) {
var link = doc.createElement("link");
link.rel = alt ? "alternate stylesheet" : "stylesheet";
head.appendChild(link);
return link;
};
function createMeta(name, content) {
var meta = doc.createElement("meta");
meta.httpEquiv = name;
meta.content = content;
head.appendChild(meta);
return meta;
};
if (!style1 && params.f_base_style)
style1 = createLink(false);
if (params.f_base_style)
style1.href = params.f_base_style;
else if (style1)
head.removeChild(style1);
if (!style2 && params.f_alt_style)
style2 = createLink(true);
if (params.f_alt_style)
style2.href = params.f_alt_style;
else if (style2)
head.removeChild(style2);
if (charset_meta) {
head.removeChild(charset_meta);
charset_meta = null;
}
if (!charset_meta && params.f_charset)
charset_meta = createMeta("Content-Type", "text/html; charset="+params.f_charset);
for (var i in params) {
var val = params[i];
switch (i) {
case "f_title":
var title = doc.getElementsByTagName("title")[0];
if (!title) {
title = doc.createElement("title");
head.appendChild(title);
} else while (node = title.lastChild)
title.removeChild(node);
if (!HTMLArea.is_ie)
title.appendChild(doc.createTextNode(val));
else
doc.title = val;
break;
case "f_doctype":
this.editor.setDoctype(val);
break;
case "f_body_bgcolor":
doc.body.style.backgroundColor = val;
break;
case "f_body_fgcolor":
doc.body.style.color = val;
break;
}
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

View File

@@ -0,0 +1,25 @@
// I18N for the FullPage plugin
// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
// Author: Holger Hees, http://www.systemconcept.de
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
FullPage.I18N = {
"Alternate style-sheet:": "Alternativer Stylesheet:",
"Background color:": "Hintergrundfarbe:",
"Cancel": "Abbrechen",
"DOCTYPE:": "DOCTYPE:",
"Document properties": "Dokumenteigenschaften",
"Document title:": "Dokumenttitel:",
"OK": "OK",
"Primary style-sheet:": "Stylesheet:",
"Text color:": "Textfarbe:"
};

View File

@@ -0,0 +1,25 @@
// I18N for the FullPage plugin
// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
// Author: Mihai Bazon, http://dynarch.com/mishoo
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
FullPage.I18N = {
"Alternate style-sheet:": "Alternate style-sheet:",
"Background color:": "Background color:",
"Cancel": "Cancel",
"DOCTYPE:": "DOCTYPE:",
"Document properties": "Document properties",
"Document title:": "Document title:",
"OK": "OK",
"Primary style-sheet:": "Primary style-sheet:",
"Text color:": "Text color:"
};

View File

@@ -0,0 +1,25 @@
// I18N for the FullPage plugin
// LANG: "fr", ENCODING: UTF-8 | ISO-8859-1
// Author: Cédric Guillemette, http://www.ebdata.com
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
FullPage.I18N = {
"Alternate style-sheet:": "Feuille de style alternative:",
"Background color:": "Couleur d'arrière plan:",
"Cancel": "Annuler",
"DOCTYPE:": "DOCTYPE:",
"Document properties": "Propriétés de document",
"Document title:": "Titre du document:",
"OK": "OK",
"Primary style-sheet:": "Feuille de style primaire:",
"Text color:": "Couleur de texte:"
};

View File

@@ -0,0 +1,25 @@
// I18N for the FullPage plugin
// LANG: "he", ENCODING: UTF-8
// Author: Liron Newman, http://www.eesh.net, <plastish at ultinet dot org>
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)

View File

@@ -0,0 +1,25 @@
// I18N for the FullPage plugin
// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
// Author: Mihai Bazon, http://dynarch.com/mishoo
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
FullPage.I18N = {
"Alternate style-sheet:": "Template CSS alternativ:",
"Background color:": "Culoare de fundal:",
"Cancel": "Renunţă",
"DOCTYPE:": "DOCTYPE:",
"Document properties": "Proprietăţile documentului",
"Document title:": "Titlul documentului:",
"OK": "Acceptă",
"Primary style-sheet:": "Template CSS principal:",
"Text color:": "Culoare text:"
};

View File

@@ -0,0 +1,143 @@
<html>
<head>
<title>Document properties</title>
<script type="text/javascript" src="../../../popups/popup.js"></script>
<script type="text/javascript">
FullPage = window.opener.FullPage; // load the FullPage plugin and lang file ;-)
window.resizeTo(400, 100);
var accepted = {
f_doctype : true,
f_title : true,
f_body_bgcolor : true,
f_body_fgcolor : true,
f_base_style : true,
f_alt_style : true,
f_charset : true
};
var editor = null;
function Init() {
__dlg_translate(FullPage.I18N);
__dlg_init();
var params = window.dialogArguments;
for (var i in params) {
if (i in accepted) {
var el = document.getElementById(i);
el.value = params[i];
}
}
editor = params.editor;
document.getElementById("f_title").focus();
document.getElementById("f_title").select();
};
function onOK() {
var required = {
};
for (var i in required) {
var el = document.getElementById(i);
if (!el.value) {
alert(required[i]);
el.focus();
return false;
}
}
var param = {};
for (var i in accepted) {
var el = document.getElementById(i);
param[i] = el.value;
}
__dlg_close(param);
return false;
};
function onCancel() {
__dlg_close(null);
return false;
};
</script>
<style type="text/css">
html, body {
background: ButtonFace;
color: ButtonText;
font: 11px Tahoma,Verdana,sans-serif;
margin: 0px;
padding: 0px;
}
body { padding: 5px; }
table {
font: 11px Tahoma,Verdana,sans-serif;
}
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
button { width: 70px; }
table .label { text-align: right; width: 12em; }
.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
border-bottom: 1px solid black; letter-spacing: 2px;
}
#buttons {
margin-top: 1em; border-top: 1px solid #999;
padding: 2px; text-align: right;
}
</style>
</head>
<body onload="Init()">
<div class="title"><span>Document properties</span></div>
<table style="width: 100%">
<tr>
<td class="label"><span>Document title:</span></td>
<td><input type="text" id="f_title" style="width: 100%" /></td>
</tr>
<tr>
<td class="label"><span>DOCTYPE:</span></td>
<td><input type="text" id="f_doctype" style="width: 100%" /></td>
</tr>
<tr>
<td class="label"><span>Primary style-sheet:</span></td>
<td><input type="text" id="f_base_style" style="width: 100%" /></td>
</tr>
<tr>
<td class="label"><span>Alternate style-sheet:</span></td>
<td><input type="text" id="f_alt_style" style="width: 100%" /></td>
</tr>
<tr>
<td class="label"><span>Background color:</span></td>
<td><input type="text" id="f_body_bgcolor" size="7" /></td>
</tr>
<tr>
<td class="label"><span>Text color:</span></td>
<td><input type="text" id="f_body_fgcolor" size="7" /></td>
</tr>
<tr>
<td class="label"><span>Character set:</span></td>
<td><select id="f_charset">
<option value=""></option>
<option value="utf-8">UTF-8 (recommended)</option>
<option value="windows-1251">cyrillic (WINDOWS-1251)</option>
<option value="koi8-r">cyrillic (KOI8-R)</option>
<option value="iso-8859-5">cyrillic (ISO-8859-5)</option>
<option value="iso-8859-1">western (ISO-8859-1)</option>
</select></td>
</tr>
</table>
<div id="buttons">
<button type="button" name="ok" onclick="return onOK();"><span>OK</span></button>
<button type="button" name="cancel" onclick="return onCancel();"><span>Cancel</span></button>
</div>
</body>
</html>

View File

@@ -0,0 +1,89 @@
<html>
<head>
<title>Test of FullPage plugin</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
_editor_url = "../../";
</script>
<!-- load the main HTMLArea files -->
<script type="text/javascript" src="../../htmlarea.js"></script>
<script type="text/javascript" src="../../lang/en.js"></script>
<script type="text/javascript" src="../../dialog.js"></script>
<!-- <script type="text/javascript" src="popupdiv.js"></script> -->
<script type="text/javascript" src="../../popupwin.js"></script>
<script type="text/javascript">
HTMLArea.loadPlugin("TableOperations");
HTMLArea.loadPlugin("SpellChecker");
HTMLArea.loadPlugin("FullPage");
function initDocument() {
var editor = new HTMLArea("editor");
editor.registerPlugin(TableOperations);
editor.registerPlugin(SpellChecker);
editor.registerPlugin(FullPage);
editor.generate();
}
</script>
<style type="text/css">
@import url(../../htmlarea.css);
</style>
</head>
<body onload="initDocument()">
<h1>Test of FullPage plugin</h1>
<textarea id="editor" style="height: 30em; width: 100%;">
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;FullPage plugin for HTMLArea&lt;/title&gt;
&lt;link rel="alternate stylesheet" href="http://dynarch.com/mishoo/css/dark.css" /&gt;
&lt;link rel="stylesheet" href="http://dynarch.com/mishoo/css/cool-light.css" /&gt;
&lt;/head&gt;
&lt;body style="background-color: #ddddee; color: #000077;"&gt;
&lt;table style="width:60%; height: 90%; margin: 2% auto 1% auto;" align="center" border="0" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td style="background-color: #ddeedd; border: 2px solid #002; height: 1.5em; padding: 2px; font: bold 24px Verdana;"&gt;
FullPage plugin
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="background-color: #fff; border: 1px solid #aab; padding: 1em 3em; font: 12px Verdana;"&gt;
&lt;p&gt;
This plugin enables one to edit a full HTML file in &lt;a
href="http://dynarch.com/htmlarea/"&gt;HTMLArea&lt;/a&gt;. This is not
normally possible with just the core editor since it only
retrieves the HTML inside the &lt;code&gt;body&lt;/code&gt; tag.
&lt;/p&gt;
&lt;p&gt;
It provides the ability to change the &lt;code&gt;DOCTYPE&lt;/code&gt; of
the document, &lt;code&gt;body&lt;/code&gt; &lt;code&gt;bgcolor&lt;/code&gt; and
&lt;code&gt;fgcolor&lt;/code&gt; attributes as well as to add additional
&lt;code&gt;link&lt;/code&gt;-ed stylesheets. Cool, eh?
&lt;/p&gt;
&lt;p&gt;
The development of this plugin was initiated and sponsored by
&lt;a href="http://thycotic.com"&gt;Thycotic Software Ltd.&lt;/a&gt;.
That's also cool, isn't it? ;-)
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea>
<hr />
<address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
<!-- Created: Wed Oct 1 19:55:37 EEST 2003 -->
<!-- hhmts start -->
Last modified on Sat Oct 25 01:06:59 2003
<!-- hhmts end -->
<!-- doc-lang: English -->
</body>
</html>