Skip to content

Editors

cvasseng edited this page Oct 17, 2016 · 3 revisions

highed.Editor(parent, attributes) - constructor

The main chart editor object

Examples

var editor = highed.Editor("my-div", {});

Arguments

  • parent - domnode: the node to attach the editor to
  • attributes - object: the editor settings
    • defaultChartOptions (object) - the initial chart options
    • on (object) - event listeners: key is event name, value is a function
    • plugins (string|array) - the editor plugins to enable
    • features (string) - the features to enable: import, export, templates, customize, welcome. Separate by string.
    • includeSVGInHTMLEmbedding (bool) - if true (which is default) the exported HTML will contain both an SVG fallback and the JavaScript injection
    • importer (object) - options passed to the contained importer object (see highed.DataImporter)
    • exporter (object) - options passd to the contained export object (see highed.DataExporter)
    • availableSettings (array) - array containing a whitelist of editable properties. Default is "show all available"

Methods

  • on(event, callback): Listen for event - returns function: Can be called to unbind the listener
    • event: string, The event to listen for
    • callback: function, Function to call when the event is emitted
  • resize():

Emitted Events

  • ChartChange: when the chart changes
    • {object} (object) - new chart data
  • ChartChangedLately: when the chart changes, on a throttle so events are not emitted more frequently than every 100ms
    • {object} (object) - new chart data

Return

highed.Editor - A new instance of an editor

Definition

./src/editors/highed.editor.js:156:
highed.Editor = function (parent, attributes) {

highed.SimpleEditor(parent, attributes) - constructor

Simple one-pane editor

An essentials-only editor.

Examples

var simpleEditor = highed.SimpleEditor(document.body, {
    availableSettings: [ "title--text", "subtitle--text" ]
});

simpleEditor.on("Change", function(chart) {
    console.log(chart.export.html());
});

Arguments

  • parent - domnode: the node to attach to
  • attributes - object: the options for the editor
    • importer (object) - options passed to the importer widget
      • options (string|array<string>) - the options to include
      • plugins (string|array<sting>) - the plugins to enable
      • availableSettings (array<string>) - the settings to include
      • chart (object) - default chart settings

Methods

  • on(event, callback): Listen for event - returns function: Can be called to unbind the listener
    • event: string, The event to listen for
    • callback: function, Function to call when the event is emitted
  • resize(): Force a resize of the editor

Emitted Events

  • change: when the chart changes
    • {highed.ChartPreview} (highed.ChartPreview) - an instance of the chart preview

Members

  • toolbar - domnode: Main toolbar
  • chart - highed.ChartPreview: The chart preview

Definition

./src/editors/highed.simple.editor.js:55:
highed.SimpleEditor = function (parent, attributes) {

highed.ModalEditor(summoner, attributes, fn) - constructor

A modal editor

The modal editor connects to a "summoner", which is the DOM node that should spawn the editor. This arg is however optional, and if not present, show() should be called instead when wanting to display it. The contained editor can either be a full editor, or a simple editor.

Examples

highed.ModalEditor("icon", {
    allowDone: true
}, function(html) {
    doSomethingWithTheExportedHTML(html);
});

Arguments

  • summoner - domnode: the node which spawns the editor
  • attributes - object: properties. Note that this object is also passed to the editor constructor.
    • type (string) - either full or simple.
    • allowDone (bool) - if set to true (default is false) a "Close and use" button will appear on the top bar
  • fn - function: function to call when done editing, argument is embeddable HTML

Methods

  • attachToSummoner(nn): Attach to a new summoner
    • nn: domnode, the new node to attach to

Definition

./src/editors/highed.modaleditor.js:52:
highed.ModalEditor = function (summoner, attributes, fn) {

highed.plugins.editor.install(name, definition) - function

Install an editor plugin

Note that plugins must be enabled when creating the editor for it to be active.

Arguments

  • name - string: the name of the plugin
  • definition - object: the plugin definition
    • meta (object) -
      • version (string) -
      • author (string) -
      • homepage (string) -
      • dependencies (array<string>) - URLs of script dependencies
      • options (object) -
        • <option_name> (object) -
          • type (string) - the type of the option
          • label (string) - the label
          • default (anything) - the default value

Definition

./src/editors/highed.editor.js:60:
function install(name, definition) {

Clone this wiki locally