main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
653 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | const Element = require('../primitives/Element');
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * @class RefElement
|
---|
| 5 | *
|
---|
| 6 | * @param content
|
---|
| 7 | * @param meta
|
---|
| 8 | * @param attributes
|
---|
| 9 | *
|
---|
| 10 | * @extends Element
|
---|
| 11 | */
|
---|
| 12 | module.exports = class RefElement extends Element {
|
---|
| 13 | constructor(content, meta, attributes) {
|
---|
| 14 | super(content || [], meta, attributes);
|
---|
| 15 | this.element = 'ref';
|
---|
| 16 |
|
---|
| 17 | if (!this.path) {
|
---|
| 18 | this.path = 'element';
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | /**
|
---|
| 23 | * Path of referenced element to transclude instead of element itself.
|
---|
| 24 | * @type StringElement
|
---|
| 25 | * @default element
|
---|
| 26 | */
|
---|
| 27 | get path() {
|
---|
| 28 | return this.attributes.get('path');
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | set path(newValue) {
|
---|
| 32 | this.attributes.set('path', newValue);
|
---|
| 33 | }
|
---|
| 34 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.