Editor

A frame which is expected to contain an editable document. Set the value of the editortype attribute to 'html' to create an editor document. Mozilla provides two types of editors, the HTML editor and the plaintext editor. The editor does not provide any editing user interface; you would supply that yourself. However, text editing, image resizing, and table row and cell editing capabilities are provided. If you do not set the editortype attribute on an editor, you must enable editing using the makeEditable method.

To specify the document to load in the editor use the src attribute. However, an issue is that if you specify the src attribute initially on the editor tag in the XUL file, the document does not become editable by default. To enable editing on an editor, do one of two things:

  1. Set the src attribute on the editor after the outer window has loaded, for example, in the onload handler. You might also set the src attribute based on what the user selects from a file dialog. In this case, set the editortype attribute on the editor.
  2. Call the makeEditable function to make the document loaded in the editor editable.

To edit a new document, set the src attribute to 'about:blank'.

Example:

    <editor src="http://www.xulplanet.com"/>
    <button label="Edit" oncommand="this.previousSibling.makeEditable('html',false);"/>

The editor element implements the following interfaces:

nsIAccessibleProvider  

編集可能な文書を内容とするものとして用意されたフレーム。(HTML の) 編集用文書を作るには editortype 属性を 'html' に設定する。 Mozilla には 2 種類のエディタ、 HTML エディタとプレーンテキストエディタが用意されている。エディタ自体は編集のためのユーザーインターフェースは提供しない。それはあなた自身が組み込むものである。とは言え、テキストの編集、画像のリサイズ、テーブルの行とセルの編集機能はすでに組み込まれている。 editor 要素に editortype 属性が指定されていない場合、 makeEditable メソッドにより編集機能を有効にしなければならない。

エディタに読み込む文書を指定するには、 src 属性を使う。でも、問題が 1 つあり、 XUL ファイルの editor タグで最初に src 属性を指定すると、その文書はデフォルトでは編集不可になっている。エディタで編集を可能にするには、次の 2 つのうちのどちらかを行うこと。

  1. 例えば onload ハンドラで外部のウィンドウが読み込んだ後、エディタの src 属性を設定する。ユーザがファイルダイアログから選択したものに基づいて、 src 属性を設定することもできる。この場合、エディタの editortype 属性を設定する。
  2. makeEditable 関数を呼び出して、エディタに読み込まれた文書を編集可能にする。

新規文書を編集するには、 src 属性を 'about:blank' に設定します。

例 :

    <editor src="http://www.xulplanet.com"/>
    <button label="Edit" oncommand="this.previousSibling.makeEditable('html',false);"/>

editor 要素は以下のインターフェイスを実装している。

nsIAccessibleProvider  

属性:

editortype src type

プロパティとメソッド:

accessible commandManager contentDocument contentWindow docShell
editingSession editortype getEditor getHTMLEditor makeEditable
webBrowserFind webNavigation

属性:

XUL Element から継承:

align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
debug
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width

editortype

Type: one of the values below

The type of editor to use. This value will be overriden depending on the content type of the document in the editor.

  • html: An HTML editor.
  • text: A plaintext editor.

型 : 以下の値の一つ

エディタの使用タイプ。この値は、エディタの文書の content type に依存して上書きされる。

  • html: HTML エディタ。
  • text: プレーンテキストエディタ。
src

Type: document URL

The URL of the file to load into the editor.

型 : document URL

エディタに読み込むファイルの URL。

type

Type: string

If set to the string 'content-primary', this editor becomes the primary content for the page. The window for the primary content can be retrieved more conveniently using 'window.content'.

型 : 文字列

文字列 'content-primary' に設定したとき、このエディタがページの主内容になる。主内容のウィンドウは、 'window.content' を使って簡易に取得することができる。


プロパティとメソッド:

XUL Element から継承:

align
allowEvents
blur
boxObject
boxObject.element
boxObject.getLookAndFeelMetric
boxObject.height
boxObject.screenX
boxObject.screenY
boxObject.width
boxObject.x
boxObject.y
builder
className
click
collapsed
contextMenu
controllers
database
datasources
dir
doCommand
flex
focus
getElementsByAttribute
height
hidden
id
left
maxHeight
maxWidth
menu
minHeight
minWidth
observes
ordinal
orient
pack
persist
ref
resource
statusText
style
tooltip
tooltipText
top
width

Element から継承:

addEventListener
appendChild
attributes
childNodes
cloneNode
dispatchEvent
firstChild
getAttribute
getAttributeNS
getAttributeNode
getAttributeNodeNS
getElementsByTagName
getElementsByTagNameNS
hasAttribute
hasAttributeNS
hasAttributes
hasChildNodes
insertBefore
isSupported
lastChild
localName
namespaceURI
nextSibling
nodeName
nodeType
nodeValue
normalize
ownerDocument
parentNode
prefix
previousSibling
removeAttribute
removeAttributeNS
removeAttributeNode
removeChild
removeEventListener
replaceChild
setAttribute
setAttributeNS
setAttributeNode
setAttributeNodeNS
tagName

accessible

Type: nsIAccessible

Returns the accessibility object for the editor.

型 : nsIAccessible

エディタの accessibility オブジェクトを返す。

commandManager

Type: nsICommandManager

The command manager handles operations on the editor.

型 : nsICommandManager

コマンドマネージャはエディタの操作を処理する。

contentDocument

Type: document

This read-only property contains the document object in the editor.

型 : document

この読み込み専用プロパティは、エディタの文書オブジェクトを持つ。

contentWindow

Type: window

This read-only property contains the window object in the editor.

型 : window

この読み込み専用プロパティは、エディタのウィンドウオブジェクトを持つ。

docShell

Type: nsIDocShell

This read-only property contains the nsIDocShell object for the document.

型 : nsIDocShell

この読み込み専用プロパティは、文書用の nsIDocShell オブジェクトを持つ。

editingSession

Type: nsIEditorSession

The editing session for the editor which is used to initialize the editor. You would not normally need to use this.

型 : nsIEditorSession

エディタを初期化するために使用する、エディタ用の編集セッション。通常、これを使用する必要はない。

editortype

Type: one of the values below

The type of editor to use. This value will be overriden depending on the content type of the document in the editor.

  • html: An HTML editor.
  • text: A plaintext editor.

型 : 以下の値の一つ

エディタの使用タイプ。この値は、エディタの文書の content type に依存して上書きされる。

  • html: HTML エディタ。
  • text: プレーンテキストエディタ。
getEditor ( window )

Return Type: nsIEditor

Returns the editing interface for the editor which contains numerous methods for manipulating the document. Pass the editor's contentWindow as the argument.

戻り値の型 : nsIEditor

文書を扱うためのたくさんのメソッドを持つエディタ用に、編集インタフェースを返す。引数としてエディタの contentWindow を渡す。

getHTMLEditor ( window )

Return Type: nsIHTMLEditor

Returns the HTML editing interface for the editor which contains methods for manipulating an HTML document. Pass the editor's contentWindow as the argument.

戻り値の型 : nsIHTMLEditor

HTML 文書を扱うための methods を持つエディタ用に、 HTML 編集インタフェースを返す。引数としてエディタの contentWindow を渡す。

makeEditable ( editortype , waitForLoad )

Return Type: no return value

This function enables editing for an editor. Specify 'text' or 'html' as the editortype.

戻り値の型 : 戻り値なし

この関数はエディタを編集可能にする。editortype に 'text' か 'html' を指定する。

webBrowserFind

Type: nsIWebBrowserFind

This read-only property contains an nsIWebBrowserFind object which can be used to search for text in the document.

型 : nsIWebBrowserFind

この読み込み専用プロパティは、文書のテキストを検索するのに使用する nsIWebBrowserFind を持つ。

webNavigation

Type: nsIWebNavigation

This read-only property contains the nsIWebNavigation object for the document. Most of its methods are callable directly on the editor itself, such as goBack and goForward. It also contains the load constants used by reloadWithFlags and loadURIWithFlags.

型 : nsIWebNavigation

この読み込み専用プロパティは、文書用の nsIWebNavigation オブジェクトを持つ。このオブジェクトのメソッド、例えば goBack や goForward は、エディタ自身で直接呼ぶことができる。また、 reloadWithFlags や loadURIWithFlags で用いられるロード定数も持っている。


Copyright (C) 1999 - 2004 XulPlanet.com