| Summary: | codeEdit: Need a way to pass statusReporter during widget creation. | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | libing wang <libingw> |
| Component: | Editor | Assignee: | libing wang <libingw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 12.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
libing wang
We will ask the end user to pass the statusReporter function as an option. For example, this function can be used in two ways: 1. The codeEdit widget will feed some message for the time being, e.g. line number and col number. 2. User can also call the function to render something, e.g., the tab mode state mentioned in bug 491792. The only concern here is that if 1 and 2 shares the same DOM node, then, for example, the tab mode could be erased by the "line number and col number" if user changes the editor caret. If that is true then 2 has to use something else. The usage of the statusReporter option would be :
var statusReporter = function(message, type, isAccessible) {
if (type === "progress") {
console.log( "Progress message: " + message);
} else if (type === "error") { //$NON-NLS-0$
console.log( "Error message: " + message);
} else {
console.log( "Normal message: " + message);
}
};
embeddedEditor.create({parent: "embeddedEditor", statusReporter: statusReporter}).then(function(editorViewer) {
We assume that each editor has its own status reporter. Note that in the multiple editor instance case if you want to share the status reporter, just pass the same function. |