-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,044 additions
and
404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
'use strict'; | ||
|
||
var OO = require('../basics/oo'); | ||
var Component = require('./component'); | ||
var $$ = Component.$$; | ||
|
||
class FontAwesomeIcon extends Component.Container { | ||
get tagName() { | ||
return 'i'; | ||
} | ||
|
||
get classNames() { | ||
return 'fa ' + this.props.icon | ||
} | ||
function FontAwesomeIcon() { | ||
Component.Container.apply(this, arguments); | ||
} | ||
|
||
FontAwesomeIcon.Prototype = function() { | ||
|
||
this.tagName = 'i'; | ||
|
||
this.getClassNames = function() { | ||
return 'fa ' + this.props.icon; | ||
}; | ||
|
||
}; | ||
|
||
OO.inherit(FontAwesomeIcon, Component.Container); | ||
|
||
module.exports = FontAwesomeIcon; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
42 changes: 23 additions & 19 deletions
42
ui/annotation_component.js → ui/nodes/annotation_component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,61 @@ | ||
"use strict"; | ||
|
||
var Component = require('./component'); | ||
var $$ = Component.$$; | ||
var OO = require('../../basics/oo'); | ||
var Component = require('../component'); | ||
|
||
class AnnotationComponent extends Component { | ||
function AnnotationComponent() { | ||
Component.apply(this, arguments); | ||
} | ||
|
||
AnnotationComponent.Prototype = function() { | ||
|
||
get tagName: function() { | ||
return 'span' | ||
} | ||
this.tagName = 'span'; | ||
|
||
get classNames: function() { | ||
this.getClassNames = function() { | ||
var typeNames = this.props.node.getTypeNames(); | ||
var classNames = typeNames.join(' '); | ||
if (this.props.classNames) { | ||
classNames += " " + this.props.classNames.join(' '); | ||
} | ||
return classNames.replace(/_/g, '-'); | ||
} | ||
}; | ||
|
||
get attributes() { | ||
this.getAttributes = function() { | ||
return { | ||
"data-id": this.props.node.id | ||
}; | ||
} | ||
}; | ||
|
||
render() { | ||
this.render = function() { | ||
if (this.props.node.active) { | ||
this.$el.addClass('active'); | ||
} else { | ||
this.$el.removeClass('active'); | ||
} | ||
return this.props.children; | ||
} | ||
}; | ||
|
||
didMount() { | ||
this.didMount = function() { | ||
var node = this.props.node; | ||
node.connect(this, { | ||
'active': this.onActiveChanged | ||
}); | ||
} | ||
}; | ||
|
||
willUnmount() { | ||
this.willUnmount = function() { | ||
var node = this.props.node; | ||
node.disconnect(this); | ||
} | ||
}; | ||
|
||
onActiveChanged() { | ||
this.onActiveChanged = function() { | ||
if (this.props.node.active) { | ||
this.$el.addClass('active'); | ||
} else { | ||
this.$el.removeClass('active'); | ||
} | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
OO.inherit(AnnotationComponent, Component); | ||
|
||
module.exports = AnnotationComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
'use strict'; | ||
|
||
var OO = require('../../basics/oo'); | ||
var Component = require('../component'); | ||
var TextProperty = require('../text_property_component'); | ||
var $$ = Component.$$; | ||
|
||
function FigureComponent() { | ||
Component.apply(this, arguments); | ||
} | ||
|
||
FigureComponent.Prototype = function() { | ||
|
||
this.getClassNames = function() { | ||
var specificType = this.props.node.type; | ||
return "content-node figure clearfix "+specificType; | ||
}; | ||
|
||
this.getAttributes = function() { | ||
return { | ||
"data-id": this.props.node.id | ||
}; | ||
}; | ||
|
||
this.render = function() { | ||
var componentRegistry = this.context.componentRegistry; | ||
var contentNode = this.props.node.getContentNode(); | ||
var ContentComponentClass = componentRegistry.get(contentNode.type); | ||
|
||
return [ | ||
$$('div', { classNames: 'label', contentEditable: false }, this.props.node.label), | ||
$$(TextProperty, { | ||
tagName: 'div', | ||
classNames: 'title', | ||
doc: this.props.doc, | ||
path: [this.props.node.id, "title"] | ||
}), | ||
$$('div', { classNames: 'figure-content' }, | ||
$$(ContentComponentClass, { | ||
doc: this.props.doc, | ||
node: contentNode | ||
}) | ||
), | ||
$$('div', { classNames: 'description small' }, | ||
$$(TextProperty, { | ||
tagName: 'div', | ||
classNames: 'caption', | ||
doc: this.props.doc, | ||
path: [this.props.node.id, "caption"] | ||
}) | ||
) | ||
]; | ||
}; | ||
}; | ||
|
||
OO.inherit(FigureComponent, Component); | ||
|
||
module.exports = FigureComponent; |
Oops, something went wrong.