mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Part of removing editorShell from Composer dialogs, form dialog work by neil@parkwaycc.co.uk, b=158881, r=cmanske, sr=dveditz
This commit is contained in:
parent
29b327b82e
commit
8033b6ca39
@ -41,8 +41,12 @@ var inputElement;
|
||||
|
||||
function Startup()
|
||||
{
|
||||
if (!InitEditorShell())
|
||||
var editor = GetCurrentEditor();
|
||||
if (!editor)
|
||||
{
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
gDialog = {
|
||||
accept: document.documentElement.getButton("accept"),
|
||||
@ -69,7 +73,7 @@ function Startup()
|
||||
|
||||
// Get a single selected input element
|
||||
var tagName = "input";
|
||||
inputElement = editorShell.GetSelectedElement(tagName);
|
||||
inputElement = editor.getSelectedElement(tagName);
|
||||
|
||||
if (inputElement)
|
||||
// We found an element and don't need to insert one
|
||||
@ -81,7 +85,7 @@ function Startup()
|
||||
// We don't have an element selected,
|
||||
// so create one with default attributes
|
||||
|
||||
inputElement = editorShell.CreateElementWithDefaults(tagName);
|
||||
inputElement = editor.createElementWithDefaults(tagName);
|
||||
if (!inputElement)
|
||||
{
|
||||
dump("Failed to get selected element or create a new one!\n");
|
||||
@ -89,7 +93,7 @@ function Startup()
|
||||
return;
|
||||
}
|
||||
|
||||
var imageElement = editorShell.GetSelectedElement("img");
|
||||
var imageElement = editor.getSelectedElement("img");
|
||||
if (imageElement)
|
||||
{
|
||||
// We found an image element, convert it to an input type="image"
|
||||
@ -326,14 +330,16 @@ function onAccept()
|
||||
// All values are valid - copy to actual element in doc or
|
||||
// element created to insert
|
||||
|
||||
editorShell.CloneAttributes(inputElement, globalElement);
|
||||
var editor = GetCurrentEditor();
|
||||
|
||||
editor.cloneAttributes(inputElement, globalElement);
|
||||
|
||||
if (insertNew)
|
||||
{
|
||||
try {
|
||||
// 'true' means delete the selection before inserting
|
||||
// in case were are converting an image to an input type="image"
|
||||
editorShell.InsertElementAtSelection(inputElement, true);
|
||||
editor.insertElementAtSelection(inputElement, true);
|
||||
} catch (e) {
|
||||
dump(e);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
<!ENTITY AdvancedEditButton.tooltip "Add or modify HTML attributes, style attributes, and JavaScript">
|
||||
<!ENTITY chooseButton.label "Choose File...">
|
||||
<!ENTITY chooseFile.accessKey "F">
|
||||
<!ENTITY chooseFileLink.accessKey "o">
|
||||
<!ENTITY makeUrlRelative.label "URL is relative to page location">
|
||||
<!ENTITY makeUrlRelative.accessKey "r">
|
||||
<!ENTITY makeUrlRelative.tooltip "Change between relative and absolute URL. You must first save the page to change this.">
|
||||
|
Loading…
Reference in New Issue
Block a user