xmind-sdk-javascript

xmind-sdk-javascript manual & documentation

NOTICE

the checked ones are APIs that are supported by the current version.

the unchecked ones are under develpment.

installation

npm install xmind

xmind

var xmind = require('xmind');

// `xmind` here is an object:
// {
//     open: Workbook.open,
//     save: Workbook.save,
//     CONST: CONST,
//     utils: utils,
//     DomMixin: DomMixin,
//     Workbook: Workbook,
//     Sheet: Sheet,
//     Topic: Topic,
//     Relationship: Relationship,
//     Legend: Legend
// }

this method returns an Workbook instance, which can be considered as an xmind document.

var workbook = xmind.open(filename);

save workbook(xmind document) to a file.

CONST

all kinds of CONSTs, attribute names, tag names, other values, etc.

utils

all kinds of helper functions

properties

DomMixin

all the constructors below is inherited from DomMixin. it provides some helper functions on Dom.

it requires all the sub-constructors instances to have a doc attribute. and the doc attribute must be an instance of xmldom DocumentElement or Element.

constructor properties

instance properties

instance can be:

Workbook

creating an instance

var Workbook = xmind.Workbook;
var workbook = new xmind.Workbook({
    /*
     * options:
     *   // when creating a new one {
     *      - firstSheetName
     *      - rootTopicName
     *   // }
     *   // when loading from an existing one {
     *      - doc
     *      - stylesDoc
     *      - attachments
     *   // }
     */
});

constructor properties

instance properties

options: {
    id: sheetId,
    title: sheetName,
    rootTopicId: rootTopicId,
    rootTopicName: rootTopicName,
    theme: theme,
}

Sheet

creating an instance

var Sheet = xmind.Sheet;
var sheet = new Sheet({
    /*
     * options:
     *   - workbook(required)
     *   // when creating a new one {
     *      - title
     *      - rootTopicName
     *      - theme
     *   // }
     *   // when loading from an existing one {
     *      - doc
     *   // }
     */
});

constructor properties

instance properties

options: {
    id: id,
    sourceId: sourceId,
    targetId: targetId,
    title: title
}

Topic

creating an instance

var Topic = xmind.Topic;
var topic = new Topic({
    /*
     * options:
     *   - sheet(required)
     *   - parent
     *   - type
     *   // when creating a new one {
     *      - title
     *      - structure
     *   // }
     *   // when loading from an existing one {
     *      - doc
     *   // }
     */
});

constructor properties

instance properties

Relationship

creating an instance

var Relationship = xmind.Relationship;
var relationship = new Relationship({
    /*
     * options:
     *   - sheet(required)
     *   // when creating a new one {
     *   // }
     *   // when loading from an existing one {
     *      - doc
     *   // }
     */
});

constructor properties

instance properties

Legend

creating an instance

var Legend = xmind.Legend;
var legend = new Legend({
    /*
     * options:
     *   - sheet(required)
     *   // when creating a new one {
     *      - title
     *   // }
     *   // when loading from an existing one {
     *      - doc
     *   // }
     */
});

constructor properties

instance properties

notes

home