CEditor
Fields
- String command
- last command in editor
- Object def
- user definition for editor, its struture is
- {
- String text
- text for editor
- Object style
- Represents style of editor's container, its structure is
- {
- int width
- width of editor container
- int height
- height of editor container
- Object | String defaultClass
- style of editor container
- String contentStyle
- Link to stylesheet file that will uses inside editor container
- }
- Object toolBar
- Represents toolbar of editor
- {
- int height
- height of toolbar
- String bgcolor
- backcolor for toolbar
- String | Object defaultClass
- style parameters of toolbar
- buttons:
- [
- {
- String name
- "bold" | "italic" | "underline" | "justifyleft" | "justifycenter" | "justifyright" | "insertorderedlist" | "insertunorderedlist" | "outdent" | "indent" | "forecolor" | "backcolor" | "createlink" | "addimage" | "cut" | "copy" | "paste" | "preview"
- String text
- label for button
- Object img_on
- {String src:, int width:, int height}
- Object img_off
- {String src:, int width:, int height}
- },
- ...
- ],
- String styletext
- Hint for style combobox
- [] styles
- [
{tag:"span", text:"Normal"},
{tag:"h1", text:"Heading 1"},
{tag:"h2", text:"Heading 2"},
{tag:"h3", text:"Heading 3"},
{tag:"h4", text:"Heading 4"},
{tag:"h5", text:"Heading 5"},
{tag:"h6", text:"Heading 6"},
{tag:"pre", text:"Formatted"},
{tag:"p", text:"Paragraph"}
] Array with predefined styles,
- String fonttext
- Hint for font combobox
- [] fonts
- [
{name:"Arial, Helvetica, sans-serif", text:"Arial"},
{name:"Courier New, Courier, mono", text:"Courier New"},
{name:"Times New Roman, Times, serif", text:"Times New Roman"},
{name:"Verdana, Arial, Helvetica, sans-serif", text:"Verdana"},
{name:"Tahoma, sans-serif", text:"Tahoma"},
{name:"Comic Sans MS, sans-serif", text:"Comic Sans MS"}
] Array with list of fonts that can be used in editor,
- String fontsizetext
- Hint for fontsize combobox
- [] fontsizes
- [1,2,3,4,5,6,7] Array with list font sizes that can be used in editor
- }
- [][] pallete
- Matrix of RGB colors
- Boolean useMail
- indicates will editor use for sending mail
- Object mailDef
- object defined e-mail options and has such structure
- {
- Boolean usesubject
- indicates will this field used for send email
- String titlesubject
- title for field subject
- String csssubject
- css class for title and field
- Boolean useto
- indicates will this field used for send email
- String titleto
- title for field subject
- String cssto
- css class for title and field
- Boolean usecc
- indicates will this field used for send email
- String titlecc
- title for field subject
- String csscc
- css class for title and field
- Boolean usebcc
- indicates will this field used for send email
- String titlebcc
- title for field subject
- String cssbcc
- css class for title and field
- Boolean usefrom
- indicates will this field used for send email
- String titlefrom
- title for field subject
- String cssfrom
- css class for title and field
- Boolean useattachments
- indicates will this field used for send email
- String titleattachments
- title for field subject
- String cssattachments
- css class for title and field
- Object mailIcon
- defines button in toolbar for send mail, structure of this Object is {name: "mail",text: String,img_on:{src: URL, width:int, height:int}},
- String mailForm
- name of FORM that embedded fields ,
- String mailAction
- URL to file-handler
- String mailLayout
- defines layout of e-mail panel. Possible values are 'top' and 'bottom'
}
}
- String id
- id of editor, that uses to access editor in global array CodeThatEditors
- Boolean isPrompt
- is prompt mode turned on | off
- Boolean isRTF
- is browser allows use execCommand method and editable elements
- [][] pallete
- Array with pallete that uses for color setting in editor
- Object style
- Represents style of editor's container, its structure is
- {
- int width
- width of editor container
- int height
- height of editor container
- Object | String defaultClass
- style of editor container
- String contentStyle
- Link to stylesheet file that will uses inside editor container
- }
- Object tb
- Represents toolbar of editor
- {
- int height
- height of toolbar
- String bgcolor
- backcolor for toolbar
- String | Object defaultClass
- style parameters of toolbar
- buttons:
- [
- {
- String name
- "bold" | "italic" | "underline" | "justifyleft" | "justifycenter" | "justifyright" | "insertorderedlist" | "insertunorderedlist" | "outdent" | "indent" | "forecolor" | "backcolor" | "createlink" | "addimage" | "cut" | "copy" | "paste" | "preview"
- String text
- label for button
- Object img_on
- {String src:, int width:, int height}
- Object img_off
- {String src:, int width:, int height}
- },
- ...
- ],
- String styletext
- Hint for style combobox
- [] styles
- [
{tag:"span", text:"Normal"},
{tag:"h1", text:"Heading 1"},
{tag:"h2", text:"Heading 2"},
{tag:"h3", text:"Heading 3"},
{tag:"h4", text:"Heading 4"},
{tag:"h5", text:"Heading 5"},
{tag:"h6", text:"Heading 6"},
{tag:"pre", text:"Formatted"},
{tag:"p", text:"Paragraph"}
] Array with predefined styles,
- String fonttext
- Hint for font combobox
- [] fonts
- [
{name:"Arial, Helvetica, sans-serif", text:"Arial"},
{name:"Courier New, Courier, mono", text:"Courier New"},
{name:"Times New Roman, Times, serif", text:"Times New Roman"},
{name:"Verdana, Arial, Helvetica, sans-serif", text:"Verdana"},
{name:"Tahoma, sans-serif", text:"Tahoma"},
{name:"Comic Sans MS, sans-serif", text:"Comic Sans MS"}
] Array with list of fonts that can be used in editor,
- String fontsizetext
- Hint for fontsize combobox
- [] fontsizes
- [1,2,3,4,5,6,7] Array with list font sizes that can be used in editor
- }
- String text
- Any HTML formatted texr
Note! Each property *Class in any Object can be String or Object
If it is String - it is css class name that defines by user in file *.css or <style> section of page
If it is Object - it is Object with fields from this list "borderwidth", "bordercolor", "borderstyle","backgroundcolor", "backgroundimage", "backgroundrepeat", "color", "fontfamily", "fontstyle", "fontweight", "fontsize","textalign", "textdecoration", "verticalalign", "padding", "cursor"
At least one field must be set in this Object
To disable toolBar set the height property with 0
Constructor
- CEditor(id, def)
- Creates CEditor object with id and from definition def
Methods
- addCode(command[, value])
- Uses for browsers that don't support execComand and contenteditable elements, adds HTML code into text that corresponds with command and its value
- create()
- Creates CEditor object
- execCommand(command[, value])
- Executes command in browser with correspond value
- getContainer()
- Get container of editor
- getTDPallete(clr)
- Returns string <td color=clr> </td> that is cell in pallete table
- getText()
- Returns text from editor
- initPallete()
- Inits pallete with color matrix defined by user
- mailToHTML()
- Returns HTML representation of e-mail panel of editor
- makeStyle(obj, param, cssName)
- Create css class from Object obj named cssName and link it with object defined by param
- paint()
- Paints editor into browser
- preview()
- Creates window with preview, uses only for browser don't suppoting execCommand
- sendMail()
- Posts e-mail form
- setMailDefault
- Sets default parameters for e-mail facilities
- setText()
- Sets text into editor
- showPallete(v, t, l)
- Shows/hides pallete at the [l, t]
- tbToHTML([cnt])
- Returns HTML representation of toolbar of editor and creates HTML container if cnt is true
Read more about CodeThatEditor >>
|