mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
First Checked In.
This commit is contained in:
parent
afdd395a17
commit
ebc0d2da0b
137
editor/ui/composer/content/EditorAppShell.xul
Normal file
137
editor/ui/composer/content/EditorAppShell.xul
Normal file
@ -0,0 +1,137 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window
|
||||
[
|
||||
|
||||
<!-- These entity declarations will go into a separare, locale file at some point -->
|
||||
<!-- Window title -->
|
||||
<!ENTITY editorWindow.title "Editor">
|
||||
|
||||
<!-- Menu items: the . means that the menu item isn't implemented yet -->
|
||||
|
||||
<!-- File menu items -->
|
||||
<!ENTITY fileMenu.label "File">
|
||||
<!ENTITY newCmd.label ".New Window">
|
||||
|
||||
]>
|
||||
|
||||
<window id="main-window" xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup()" title="&editorWindow.title;">
|
||||
|
||||
<html:script>
|
||||
var editorType = "html";
|
||||
var editorName = "EditorAppCoreHTML";
|
||||
</html:script>
|
||||
|
||||
<html:script language="JavaScript" src="chrome://editor/skin/EditorCommands.js">
|
||||
</html:script>
|
||||
|
||||
<broadcaster id="canPrint"/>
|
||||
|
||||
<menubar>
|
||||
<menu name="&fileMenu.label;">
|
||||
<menuitem name="&newCmd.label;" onclick=""/>
|
||||
<menuitem name=".Change Icons" onclick=""/>
|
||||
<separator />
|
||||
<menuitem name=".Print Setup" onclick=""/>
|
||||
<menuitem name="Print Preview" onclick="EditorPrintPreview()"/>
|
||||
<menuitem name=".Print" onclick=""/>
|
||||
<separator />
|
||||
<menuitem name=".Close" onclick=""/>
|
||||
<menuitem name="Quit" onclick="EditorExit()"/>
|
||||
</menu>
|
||||
|
||||
<menu name="Edit">
|
||||
<menuitem name="Undo" onclick="EditorUndo()"/>
|
||||
<menuitem name="Redo" onclick="EditorRedo()"/>
|
||||
<separator />
|
||||
<menuitem name="Cut" onclick="EditorCut()"/>
|
||||
<menuitem name="Copy" onclick="EditorCopy()"/>
|
||||
<menuitem name="Paste" onclick="EditorPaste()"/>
|
||||
<menuitem name=".Clear" onclick=""/>
|
||||
<separator />
|
||||
<menuitem name="Select All" onclick="EditorSelectAll()"/>
|
||||
<separator />
|
||||
<menuitem name="Find..." onclick="EditorFind(true)"/>
|
||||
<menuitem name="Find Again" onclick="EditorFind(false)"/>
|
||||
</menu>
|
||||
|
||||
<menu name="View">
|
||||
<menuitem name=".Hide Composition Toolbar" onclick=""/>
|
||||
<menuitem name=".Hide Format Toolbar" onclick="" />
|
||||
</menu>
|
||||
|
||||
<menu name="Insert">
|
||||
<menuitem name="Link..." onclick="EditorInsertLink()"/>
|
||||
<menuitem name=".Target..." onclick=""/>
|
||||
<menuitem name="Image..." onclick="EditorInsertImage()"/>
|
||||
<menuitem name=".Horizontal Line" onclick=""/>
|
||||
<menuitem name=".Table" onclick=""/>
|
||||
<menuitem name=".HTML Tag..." onclick=""/>
|
||||
<separator />
|
||||
<menuitem name=".Line Break" onclick=""/>
|
||||
<menuitem name=".Break Below Image(s)" onclick=""/>
|
||||
</menu>
|
||||
|
||||
<menu name="Format">
|
||||
<menuitem name=".Font" onclick=""/>
|
||||
<menuitem name=".Size" onclick=""/>
|
||||
<menuitem name=".Style" onclick=""/>
|
||||
<menuitem name=".Color..." onclick=""/>
|
||||
<menuitem name=".Remove All Style(s)" onclick=""/>
|
||||
<separator />
|
||||
<menuitem name=".Heading" onclick=""/>
|
||||
</menu>
|
||||
<menu name="Tools">
|
||||
<menuitem name=".Spell Check" onclick=""/>
|
||||
</menu>
|
||||
<menu name="Debug">
|
||||
<menuitem name="Output Text" onclick="EditorGetText()"/>
|
||||
<menuitem name="Output HTML" onclick="EditorGetHTML()"/>
|
||||
<separator />
|
||||
<menuitem name="Insert Text" onclick="EditorInsertText()"/>
|
||||
<separator />
|
||||
<menuitem name="Test Selection" onclick="EditorTestSelection()"/>
|
||||
<menuitem name="Test Document" onclick="EditorTestDocument()"/>
|
||||
</menu>
|
||||
<menu name="Help">
|
||||
<menuitem name=".About" onclick=""/>
|
||||
</menu>
|
||||
|
||||
</menubar>
|
||||
|
||||
<box id="outer-box" align="vertical">
|
||||
|
||||
<broadcaster id="Editor:Style:IsBold" bold="false"/>
|
||||
<broadcaster id="Editor:Style:IsItalic"/>
|
||||
<broadcaster id="Editor:Style:IsUnderline"/>
|
||||
|
||||
<toolbox>
|
||||
<toolbar>
|
||||
<titledbutton align="left" class="popup" value="Normal"/>
|
||||
<titledbutton align="left" class="popup" value="Size"/>
|
||||
<titledbutton align="left" class="popup" value="Color"/>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_Bold.gif" align="bottom"
|
||||
onclick="EditorApplyStyle('b')">
|
||||
<observes element="Editor:Style:IsBold" attribute="bold" onchange="onBoldChange()"/>
|
||||
</titledbutton>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_Italic.gif" align="bottom" onclick="EditorApplyStyle('i')"/>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_Underline.gif" align="bottom" onclick="EditorApplyStyle('u')"/>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_ClearStyle.gif" align="bottom" onclick="EditorRemoveStyle('all')"/>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_Bullets.gif" align="bottom" onclick="EditorInsertList('ul')"/>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_Numbers.gif" align="bottom" onclick="EditorInsertList('ol')"/>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_Indent.gif" align="bottom" onclick="EditorIndent('indent')"/>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_Left.gif" align="bottom" class="popup" onclick="EditorAlign('left')"/>
|
||||
<titledbutton src="chrome://editor/skin/images/ED_Link.gif" align="bottom" class="popup" onclick="EditorInsertLink()"/>
|
||||
</toolbar>
|
||||
</toolbox>
|
||||
|
||||
<html:iframe id="content-frame" html:name="content" html:src="chrome://editor/content/EditorInitPage.html" flex="100%" />
|
||||
|
||||
</box>
|
||||
</window>
|
||||
|
||||
|
300
editor/ui/composer/content/EditorCommands.js
Normal file
300
editor/ui/composer/content/EditorCommands.js
Normal file
@ -0,0 +1,300 @@
|
||||
|
||||
/* the following variables are expected to be defined
|
||||
in the embedding file:
|
||||
|
||||
var editorType -- the editor type, i.e. "text" or "html"
|
||||
var editorName -- the name of the editor. Must be unique to this window clique
|
||||
*/
|
||||
|
||||
function Startup()
|
||||
{
|
||||
dump("Doing Startup...\n");
|
||||
appCore = XPAppCoresManager.Find("EditorAppCore");
|
||||
dump("Looking up EditorAppCore...\n");
|
||||
if (appCore == null) {
|
||||
dump("Creating EditorAppCore...\n");
|
||||
appCore = new EditorAppCore();
|
||||
if (appCore != null) {
|
||||
dump("EditorAppCore has been created.\n");
|
||||
appCore.Init(editorName);
|
||||
appCore.setEditorType(editorType);
|
||||
appCore.setContentWindow(window.frames[0]);
|
||||
appCore.setWebShellWindow(window);
|
||||
appCore.setToolbarWindow(window);
|
||||
}
|
||||
} else {
|
||||
dump("EditorAppCore has already been created! Why?\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorFind(firstTime)
|
||||
{
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
if (toolkitCore && firstTime) {
|
||||
toolkitCore.ShowWindow("resource:/res/samples/find.xul", window);
|
||||
}
|
||||
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
appCore.find("test", true, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function EditorApplyStyle(styleName)
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Applying Style\n");
|
||||
appCore.setTextProperty(styleName, null, null);
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorRemoveStyle(styleName)
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Removing Style\n");
|
||||
appCore.removeTextProperty(styleName, null);
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorGetText()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Getting text\n");
|
||||
var outputText = appCore.contentsAsText;
|
||||
dump(outputText + "\n");
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorGetHTML()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Getting HTML\n");
|
||||
var outputText = appCore.contentsAsHTML;
|
||||
dump(outputText + "\n");
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorUndo()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Undoing\n");
|
||||
appCore.undo();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorRedo()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Redoing\n");
|
||||
appCore.redo();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorCut()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Cutting\n");
|
||||
appCore.cut();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorCopy()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Copying\n");
|
||||
appCore.copy();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorPaste()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Pasting\n");
|
||||
appCore.paste();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorSelectAll()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Selecting all\n");
|
||||
appCore.selectAll();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorInsertText()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Inserting text\n");
|
||||
appCore.insertText("Once more into the breach, dear friends.\n");
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorInsertLink()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Inserting link\n");
|
||||
appCore.insertLink();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorInsertList(listType)
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Inserting link\n");
|
||||
appCore.insertList(listType);
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorInsertImage()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Inserting image\n");
|
||||
appCore.insertImage();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorExit()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null) {
|
||||
dump("Exiting\n");
|
||||
appCore.exit();
|
||||
} else {
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorPrintPreview() {
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore)
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
if (toolkitCore) {
|
||||
toolkitCore.ShowWindow("resource:/res/samples/printsetup.html", window);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function EditorTestSelection()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null)
|
||||
{
|
||||
dump("Testing selection\n");
|
||||
var selection = appCore.editorSelection;
|
||||
if (selection)
|
||||
{
|
||||
dump("Got selection\n");
|
||||
var firstRange = selection.getRangeAt(0);
|
||||
if (firstRange)
|
||||
{
|
||||
dump("Range contains \"");
|
||||
dump(firstRange.toString() + "\"\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function EditorTestDocument()
|
||||
{
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if (appCore != null)
|
||||
{
|
||||
dump("Getting document\n");
|
||||
var theDoc = appCore.editorDocument;
|
||||
if (theDoc)
|
||||
{
|
||||
dump("Got the doc\n");
|
||||
dump("Document name:" + theDoc.nodeName + "\n");
|
||||
dump("Document type:" + theDoc.doctype + "\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
dump("Failed to get the doc\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dump("EditorAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Status calls */
|
||||
function onBoldChange()
|
||||
{
|
||||
var button = document.getElementById("Editor:Style:IsBold");
|
||||
if (button)
|
||||
{
|
||||
var bold = button.getAttribute("bold");
|
||||
|
||||
if ( bold == "true" ) {
|
||||
button.setAttribute( "disabled", false );
|
||||
}
|
||||
else {
|
||||
button.setAttribute( "disabled", true );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dump("Can't find bold broadcaster!\n");
|
||||
}
|
||||
}
|
123
editor/ui/dialogs/skin/EditorDialog.css
Normal file
123
editor/ui/dialogs/skin/EditorDialog.css
Normal file
@ -0,0 +1,123 @@
|
||||
/* XUL ELEMENTS */
|
||||
window, WINDOW {
|
||||
display: block;
|
||||
width: 100%;
|
||||
background: silver;
|
||||
background-color: #CCCCCC; /* not working on Macintosh */
|
||||
padding: 5px;
|
||||
font-family: Sans-Serif;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
/* Defeat the default behavior of borderless until rollover */
|
||||
button { border: 2px outset }
|
||||
|
||||
/* values = margin, padding. Padding doesn't work yet */
|
||||
checkbox, CHECKBOX { margin: 5px 3px }
|
||||
|
||||
radio, RADIO { margin: 5px 3px }
|
||||
|
||||
tree, TREE {
|
||||
display: table;
|
||||
background-color: #000000;
|
||||
border: none;
|
||||
border-spacing: 0px;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* HTML ELEMENTS */
|
||||
/* Force all rows to line up cell contents at the top */
|
||||
tr, TR { vertical-align: top }
|
||||
|
||||
/* FOR DEBUG PURPOSE -- SHOW CELL BORDER */
|
||||
td, TD { border-width: 0px; border-style: inset }
|
||||
|
||||
table, TABLE { border-width: 0px }
|
||||
|
||||
p, br, td {
|
||||
font-family: Sans-Serif;
|
||||
font-size: 8pt;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px
|
||||
}
|
||||
|
||||
fieldset, FIELDSET {
|
||||
border-width: 3px;
|
||||
border-style: groove;
|
||||
padding: 3px;
|
||||
margin: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
legend, LEGEND {
|
||||
font-family: Sans-Serif;
|
||||
font-size: 10pt;
|
||||
border-width: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* CLASSES */
|
||||
[CLASS~=GrooveBorder] { border: 2px groove; padding: 3px }
|
||||
|
||||
[CLASS~=RidgeBorder] { border: 2px ridge; padding: 3px }
|
||||
|
||||
[CLASS~=OutsetBorder] { border: 1px outset; padding: 3px }
|
||||
|
||||
[CLASS~=InsetBorder] { border: 1px inset; padding: 3px }
|
||||
|
||||
|
||||
.tableCenterAlign {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.genericbutton {
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
/* IDs only one button per dialog */
|
||||
#okbutton {
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
left: 385px;
|
||||
top: 320px;
|
||||
align: right;
|
||||
font-style: normal; position: absolute; visibility: visible; z-index: auto
|
||||
}
|
||||
|
||||
#cancelbutton {
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
left: 295px;
|
||||
top: 320px;
|
||||
align: right;
|
||||
font-style: normal; position: absolute; visibility: visible; z-index: auto
|
||||
}
|
||||
|
||||
#applybutton {
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
left: 205px;
|
||||
top: 320px;
|
||||
align: right; font-style: normal; position: absolute; visibility: visible; z-index: auto
|
||||
}
|
||||
|
||||
#helpbutton {
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
left: 10px;
|
||||
top: 320px;
|
||||
align : left;
|
||||
font-style: normal; position: absolute; visibility: visible; z-index: auto
|
||||
}
|
||||
|
||||
#extrahtmlbutton {
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
align: right;
|
||||
left: 385px;
|
||||
font-style: normal; position: absolute; visibility: visible; z-index: auto
|
||||
}
|
Loading…
Reference in New Issue
Block a user