This commit is contained in:
jfrancis%netscape.com 1999-08-09 22:51:40 +00:00
Родитель f5319121ed
Коммит 65ac5c1602
6 изменённых файлов: 38 добавлений и 6 удалений

Просмотреть файл

@ -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__