зеркало из https://github.com/mozilla/pjs.git
fixing bug 9366
This commit is contained in:
Родитель
f5319121ed
Коммит
65ac5c1602
|
@ -113,6 +113,8 @@ nsHTMLEditRules::WillDoAction(nsIDOMSelection *aSelection,
|
|||
return WillMakeAddress(aSelection, aCancel);
|
||||
case kMakePRE:
|
||||
return WillMakePRE(aSelection, aCancel);
|
||||
case kInsertElement:
|
||||
return WillInsert(aSelection, aCancel);
|
||||
}
|
||||
return nsTextEditRules::WillDoAction(aSelection, aInfo, aCancel);
|
||||
}
|
||||
|
|
|
@ -1063,6 +1063,13 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
|||
if (!NS_SUCCEEDED(res) || !selection)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// hand off to the rules system, see if it has anything to say about this
|
||||
PRBool cancel;
|
||||
nsTextRulesInfo ruleInfo(nsHTMLEditRules::kInsertElement);
|
||||
ruleInfo.insertElement = aElement;
|
||||
res = mRules->WillDoAction(selection, &ruleInfo, &cancel);
|
||||
if (cancel || (NS_FAILED(res))) return res;
|
||||
|
||||
// Clear current selection.
|
||||
// Should put caret at anchor point?
|
||||
if (!aDeleteSelection)
|
||||
|
@ -1164,7 +1171,7 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
|||
}
|
||||
// Now we can insert the new node
|
||||
res = InsertNode(aElement, parent, offsetForInsert);
|
||||
|
||||
|
||||
// Set caret after element, but check for special case
|
||||
// of inserting table-related elements: set in first cell instead
|
||||
if (!SetCaretInTableCell(aElement))
|
||||
|
|
|
@ -75,7 +75,8 @@ public:
|
|||
kAlign = 3004,
|
||||
kMakeHeader = 3005,
|
||||
kMakeAddress = 3006,
|
||||
kMakePRE = 3007
|
||||
kMakePRE = 3007,
|
||||
kInsertElement = 3008
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -175,7 +176,10 @@ class nsTextRulesInfo : public nsRulesInfo
|
|||
outString(0),
|
||||
typeInState(),
|
||||
maxLength(-1),
|
||||
collapsedAction(nsIEditor::eDeleteNext)
|
||||
collapsedAction(nsIEditor::eDeleteNext),
|
||||
bOrdered(PR_FALSE),
|
||||
alignType(0),
|
||||
insertElement(0)
|
||||
{};
|
||||
|
||||
virtual ~nsTextRulesInfo() {};
|
||||
|
@ -195,6 +199,9 @@ class nsTextRulesInfo : public nsRulesInfo
|
|||
|
||||
// kAlign
|
||||
const nsString *alignType;
|
||||
|
||||
// kInsertElement
|
||||
const nsIDOMElement* insertElement;
|
||||
};
|
||||
|
||||
#endif //nsTextEditRules_h__
|
||||
|
|
|
@ -113,6 +113,8 @@ nsHTMLEditRules::WillDoAction(nsIDOMSelection *aSelection,
|
|||
return WillMakeAddress(aSelection, aCancel);
|
||||
case kMakePRE:
|
||||
return WillMakePRE(aSelection, aCancel);
|
||||
case kInsertElement:
|
||||
return WillInsert(aSelection, aCancel);
|
||||
}
|
||||
return nsTextEditRules::WillDoAction(aSelection, aInfo, aCancel);
|
||||
}
|
||||
|
|
|
@ -1063,6 +1063,13 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
|||
if (!NS_SUCCEEDED(res) || !selection)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// hand off to the rules system, see if it has anything to say about this
|
||||
PRBool cancel;
|
||||
nsTextRulesInfo ruleInfo(nsHTMLEditRules::kInsertElement);
|
||||
ruleInfo.insertElement = aElement;
|
||||
res = mRules->WillDoAction(selection, &ruleInfo, &cancel);
|
||||
if (cancel || (NS_FAILED(res))) return res;
|
||||
|
||||
// Clear current selection.
|
||||
// Should put caret at anchor point?
|
||||
if (!aDeleteSelection)
|
||||
|
@ -1164,7 +1171,7 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
|||
}
|
||||
// Now we can insert the new node
|
||||
res = InsertNode(aElement, parent, offsetForInsert);
|
||||
|
||||
|
||||
// Set caret after element, but check for special case
|
||||
// of inserting table-related elements: set in first cell instead
|
||||
if (!SetCaretInTableCell(aElement))
|
||||
|
|
|
@ -75,7 +75,8 @@ public:
|
|||
kAlign = 3004,
|
||||
kMakeHeader = 3005,
|
||||
kMakeAddress = 3006,
|
||||
kMakePRE = 3007
|
||||
kMakePRE = 3007,
|
||||
kInsertElement = 3008
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -175,7 +176,10 @@ class nsTextRulesInfo : public nsRulesInfo
|
|||
outString(0),
|
||||
typeInState(),
|
||||
maxLength(-1),
|
||||
collapsedAction(nsIEditor::eDeleteNext)
|
||||
collapsedAction(nsIEditor::eDeleteNext),
|
||||
bOrdered(PR_FALSE),
|
||||
alignType(0),
|
||||
insertElement(0)
|
||||
{};
|
||||
|
||||
virtual ~nsTextRulesInfo() {};
|
||||
|
@ -195,6 +199,9 @@ class nsTextRulesInfo : public nsRulesInfo
|
|||
|
||||
// kAlign
|
||||
const nsString *alignType;
|
||||
|
||||
// kInsertElement
|
||||
const nsIDOMElement* insertElement;
|
||||
};
|
||||
|
||||
#endif //nsTextEditRules_h__
|
||||
|
|
Загрузка…
Ссылка в новой задаче