public class LinePlugin extends org.xwiki.gwt.wysiwyg.client.plugin.internal.AbstractPlugin implements CommandListener
| Modifier and Type | Field and Description |
|---|---|
static String |
BR
The name of the
<br/> tag. |
static String |
CLASS_NAME
The class name attribute.
|
protected DOMUtils |
domUtils
Collection of DOM utility methods.
|
static String |
LI
The name of the
<li> tag. |
static String |
LINE_BREAK
The CSS class name associated with BRs that are present in the rich text area's HTML input and which have to be
kept even when they are placed at the end of a block-level element.
|
static Command |
RESET
The command that notifies us when the content of the rich text area has been reset.
|
static String |
SPACER
The CSS class name associated with BRs added at edit time to make items like empty block-level elements editable.
|
static Command |
SUBMIT
The command that stores the value of the rich text area in an HTML form field.
|
static String |
TD
The name of the
<td> tag. |
static String |
TH
The name of the
<th> tag. |
| Constructor and Description |
|---|
LinePlugin() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
adjustLineBreak(com.google.gwt.dom.client.Node container,
com.google.gwt.dom.client.Node br)
Adjusts the line break position so that:
Anchors don't start or end with a line break.
|
protected void |
copyLineStyle(Element sourceLine,
Element destinationLine)
Copy some of the CSS styles from the source line to the destination line.
|
void |
destroy() |
protected void |
ensureLineBreakIsVisible(com.google.gwt.dom.client.Node lineBreak,
com.google.gwt.dom.client.Node container)
Ensures that the line created by inserting a line break is visible.
|
protected void |
handleRepeatableKey(Event event)
Handles a repeatable key press.
|
void |
init(RichTextArea textArea,
Config config) |
protected void |
insertEmptyLine(com.google.gwt.dom.client.Node container,
Range caret)
Inserts an empty line before the block containing the caret.
|
protected void |
insertLineBreak(com.google.gwt.dom.client.Node container,
Range caret)
Inserts a line break at the specified position in the document.
|
protected boolean |
isAfterLineBreak(com.google.gwt.dom.client.Node container,
Range caret) |
protected boolean |
isAtStart(com.google.gwt.dom.client.Node container,
Range caret) |
protected boolean |
isEmptyLine(com.google.gwt.dom.client.Node node) |
protected boolean |
isLineBreak(com.google.gwt.dom.client.Node node) |
protected void |
markInitialLineBreaks()
Marks the initial line breaks so they are not mistaken as
SPACER. |
protected void |
markSpacers()
Marks the BRs that have been added as spacers during the editing.
|
protected boolean |
needsSpace(com.google.gwt.dom.client.Node leaf) |
protected void |
onBackspace(Event event)
Overwrites the default rich text area behavior when the Backspace key is being pressed.
|
boolean |
onBeforeCommand(CommandManager sender,
Command command,
String param) |
void |
onCommand(CommandManager sender,
Command command,
String param) |
protected void |
onEnter(Event event)
Overwrites the default rich text area behavior when the Enter key is being pressed.
|
protected void |
onEnterParagraph(com.google.gwt.dom.client.Node container,
Range caret,
Event event)
Behaves as if the caret is inside a paragraph.
|
protected void |
onReset()
Called after the content of the rich text area has been reset.
|
protected void |
replaceEmptyLinesWithParagraphs()
Replaces
<div class="wikimodel-emptyline"/> with <p/>. |
protected void |
splitLine(com.google.gwt.dom.client.Node container,
Range caret)
Splits a line after a line break.
|
protected void |
unMarkSpacers() |
getConfig, getTextArea, getUIExtensionList, getUIExtensions, saveRegistration, saveRegistrationspublic static final Command SUBMIT
public static final Command RESET
public static final String SPACER
public static final String LINE_BREAK
SPACER BRs we add during the editing.public static final String CLASS_NAME
public static final String BR
<br/> tag.public static final String LI
<li> tag.public static final String TD
<td> tag.public static final String TH
<th> tag.protected final DOMUtils domUtils
public void init(RichTextArea textArea, Config config)
init in interface Plugininit in class org.xwiki.gwt.wysiwyg.client.plugin.internal.AbstractPluginpublic void destroy()
destroy in interface Plugindestroy in class org.xwiki.gwt.wysiwyg.client.plugin.internal.AbstractPluginprotected void handleRepeatableKey(Event event)
event - the native event that was firedpublic boolean onBeforeCommand(CommandManager sender, Command command, String param)
onBeforeCommand in interface CommandListenerCommandListener.onBeforeCommand(CommandManager, Command, String)public void onCommand(CommandManager sender, Command command, String param)
onCommand in interface CommandListenerCommandListener.onCommand(CommandManager, Command, String)protected void markSpacers()
protected void unMarkSpacers()
markSpacers()protected boolean needsSpace(com.google.gwt.dom.client.Node leaf)
leaf - a DOM node which has not childrentrue if the given leaf needs space on the screen in order to be rendered, false otherwiseprotected void markInitialLineBreaks()
SPACER.protected void replaceEmptyLinesWithParagraphs()
<div class="wikimodel-emptyline"/> with <p/>. Empty lines are used by WikiModel to
separate block level elements, but since the user should be able to write on these empty lines we convert them to
paragraphs.protected void onEnter(Event event)
event - the native event that was firedprotected void onEnterParagraph(com.google.gwt.dom.client.Node container,
Range caret,
Event event)
container - a block-level element containing the caretcaret - the position of the caret inside the documentevent - the native event that was firedprotected boolean isAtStart(com.google.gwt.dom.client.Node container,
Range caret)
container - a block level element containing the caretcaret - the position of the caret inside the documenttrue if the caret is at the beginning of its block level container, false otherwiseprotected boolean isAfterLineBreak(com.google.gwt.dom.client.Node container,
Range caret)
container - a block level element containing the caretcaret - the position of the caret in the documenttrue if the caret is immediately after a line break inside the given container, false
otherwiseprotected boolean isLineBreak(com.google.gwt.dom.client.Node node)
node - a DOM nodetrue if the given node marks a line break, false otherwiseprotected void adjustLineBreak(com.google.gwt.dom.client.Node container,
com.google.gwt.dom.client.Node br)
container - the block-level element containing the line breakbr - the line breakWhen hitting Return at the end of the link the new line should not be a linkprotected void insertLineBreak(com.google.gwt.dom.client.Node container,
Range caret)
container - a block-level element containing the caretcaret - the place where to insert the line breakprotected void ensureLineBreakIsVisible(com.google.gwt.dom.client.Node lineBreak,
com.google.gwt.dom.client.Node container)
lineBreak - the line break that was insertedcontainer - the container (e.g. the paragraph) where the line break was insertedprotected void splitLine(com.google.gwt.dom.client.Node container,
Range caret)
container - a block-level element containing the caretcaret - the position of the caret in the documentprotected void insertEmptyLine(com.google.gwt.dom.client.Node container,
Range caret)
container - a block-level element containing the caretcaret - the place where to insert the empty lineprotected void onBackspace(Event event)
event - the native event that was firedprotected boolean isEmptyLine(com.google.gwt.dom.client.Node node)
node - a DOM nodetrue if the given node represents an empty lineprotected void onReset()
protected void copyLineStyle(Element sourceLine, Element destinationLine)
sourceLine - the line from where to copy the stylesdestinationLine - the line whose style will be changedsplitLine(Node, Range)Copyright © 2004–2015 XWiki. All rights reserved.