Skip to content
SteveRidout edited this page Sep 5, 2012 · 8 revisions

Bare-bones example

A basic example of it's use is the bare-bones example Code Editor page.

Reference implementation

See the relevant files in the reference implementation for a more complete example:

Full configuration options example

	var codeEditor = new CSLEDIT_CodeEditor('#codeEditorContainer', {
		initialCslCode : '<style>this style is not valid!</style>',
		onChange : function (cslCode) {
			// do something after each change
		}
	});

Interacting with it once it's running

	require(['src/dataInstance'], function (CSLEDIT_data) {
		// Get the current csl code:
		var cslCode = CSLEDIT_data.getCslCode();
		alert('CSL code: ' + cslCode);

		// Get the current style name
		var title = CSLEDIT_data.getNodesFromPath("style/info/title")[0].textValue;
		alert('Style Title: ' + title);
	});