44 lines
4.9 KiB
JavaScript
44 lines
4.9 KiB
JavaScript
import { Directive, Input, ContentChildren } from '@angular/core';
|
|
import { CKButtonDirective } from './ckbutton.directive';
|
|
import * as i0 from "@angular/core";
|
|
/**
|
|
* CKGroup component
|
|
* Usage :
|
|
* <ckeditor [(ngModel)]="data" [config]="{...}" debounce="500">
|
|
* <ckgroup [name]="'exampleGroup2'" [previous]="'1'" [subgroupOf]="'exampleGroup1'">
|
|
* .
|
|
* .
|
|
* </ckgroup>
|
|
* </ckeditor>
|
|
*/
|
|
export class CKGroupDirective {
|
|
ngAfterContentInit() {
|
|
// Reconfigure each button's toolbar property within ckgroup to hold its parent's name
|
|
this.toolbarButtons.forEach((button) => (button.toolbar = this.name));
|
|
}
|
|
initialize(editor) {
|
|
editor.instance.ui.addToolbarGroup(this.name, this.previous, this.subgroupOf);
|
|
// Initialize each button within ckgroup
|
|
this.toolbarButtons.forEach((button) => {
|
|
button.initialize(editor);
|
|
});
|
|
}
|
|
}
|
|
CKGroupDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CKGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
CKGroupDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: CKGroupDirective, selector: "ckgroup", inputs: { name: "name", previous: "previous", subgroupOf: "subgroupOf" }, queries: [{ propertyName: "toolbarButtons", predicate: CKButtonDirective }], ngImport: i0 });
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CKGroupDirective, decorators: [{
|
|
type: Directive,
|
|
args: [{
|
|
selector: 'ckgroup',
|
|
}]
|
|
}], propDecorators: { name: [{
|
|
type: Input
|
|
}], previous: [{
|
|
type: Input
|
|
}], subgroupOf: [{
|
|
type: Input
|
|
}], toolbarButtons: [{
|
|
type: ContentChildren,
|
|
args: [CKButtonDirective]
|
|
}] } });
|
|
//# sour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