Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/acryps/page-tagged-editor

Tagged Template Editor for @acryps/page
https://github.com/acryps/page-tagged-editor

Last synced: 5 days ago
JSON representation

Tagged Template Editor for @acryps/page

Awesome Lists containing this project

README

        

# page tagged editor
Create templates visually with ease.

## usage
Add the editor to your component.
Define your tags by passing them to the component.

```
export class BroadcastMailComposer extends Component {
mail: MailTemplate;

onload() {
// load your template and prepare the component
}

render() {
return

Broadcast Mail

{new TaggedEditor(
mail.template,
[
new Tag('Recipient Mail', 'address', '${recipient}'),
new Tag('Given Name', 'name', '${name:given}'),
new Tag('Family Name', 'name', '${name:family}'),
],
template => {
mail.template = template;

// save your template
}
)}
;
}
}
```

We do not provide default styling, but the editor requires some controlling styles to work properly, include them from `source/index.scss`.

The `type` argument of a `Tag` will be set as an attribute, which can be used to style the tag by type
```
&[ui-type="address"] {
color: #f00;
}

&[ui-type="name"] {
color: #0f0;
}
```

`renderTagList`, `renderTag` and `extractValue` may be overwritten by creating a custom subclass

```
class GroupedTaggedEditor extends TaggedEditor {
constructor(
private source: string,
private groups: Map
private save: (value: string) => void
) {
super(source, [...groups.values()], save);
}

renderTagList() {
return
{this.groups.entries().map((group, tags) =>

{group}



{this.renderTag(tag)}

)}

}
}
```