UNPKG

angular-xml-editor

Version:
77 lines (76 loc) 6.14 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ import { Component } from '@angular/core'; var DomBreakcrumbComponent = /** @class */ (function () { function DomBreakcrumbComponent() { this.nodes = []; } /** * @return {?} */ DomBreakcrumbComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; /** * @param {?} selection * @return {?} */ DomBreakcrumbComponent.prototype.showSelection = /** * @param {?} selection * @return {?} */ function (selection) { if (selection === undefined) { this.nodes = ['none']; } else { /** @type {?} */ var collectNodes = []; /** @type {?} */ var node = selection.focusNode; /** @type {?} */ var reachedTop = node === undefined || node === null; while (!reachedTop) { switch (node.nodeType) { case Node.ELEMENT_NODE: // element node /** @type {?} */ var asElement = /** @type {?} */ (node); if (asElement !== undefined) { /** @type {?} */ var name_1 = asElement.getAttribute('data-tagname'); if (asElement.className === 'sws-xml-editor-textarea') { reachedTop = true; } else { collectNodes.unshift(name_1); } } } node = node.parentElement; if (node === undefined || node == null) { reachedTop = true; } } this.nodes = collectNodes; } }; DomBreakcrumbComponent.decorators = [ { type: Component, args: [{ selector: 'axed-dom-breakcrumb', template: "<ul>\r\n <li *ngFor=\"let element of nodes\">\r\n {{ element }}\r\n </li>\r\n</ul>\r\n", styles: ["ul{list-style-type:none;margin:0;padding:0}ul li{display:inline-block;zoom:1;padding-right:10px}ul li::before{content:'>';color:#d3d3d3}"] }] } ]; /** @nocollapse */ DomBreakcrumbComponent.ctorParameters = function () { return []; }; return DomBreakcrumbComponent; }()); export { DomBreakcrumbComponent }; if (false) { /** @type {?} */ DomBreakcrumbComponent.prototype.nodes; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9tLWJyZWFrY3J1bWIuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vYW5ndWxhci14bWwtZWRpdG9yLyIsInNvdXJjZXMiOlsibGliL2NvbXBvbmVudHMvZG9tLWJyZ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W9uLmZvY3VzTm9kZTtcclxuICAgICAgbGV0IHJlYWNoZWRUb3AgPSBub2RlID09PSB1bmRlZmluZWQgfHwgbm9kZSA9PT0gbnVsbDtcclxuICAgICAgd2hpbGUgKCFyZWFjaGVkVG9wKSB7XHJcbiAgICAgICAgc3dpdGNoIChub2RlLm5vZGVUeXBlKSB7XHJcbiAgICAgICAgICBjYXNlIE5vZGUuRUxFTUVOVF9OT0RFOiAvLyBlbGVtZW50IG5vZGVcclxuICAgICAgICAgICAgY29uc3QgYXNFbGVtZW50ID0gbm9kZSBhcyBFbGVtZW50O1xyXG4gICAgICAgICAgICBpZiAoYXNFbGVtZW50ICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICBjb25zdCBuYW1lID0gYXNFbGVtZW50LmdldEF0dHJpYnV0ZSgnZGF0YS10YWduYW1lJyk7XHJcbiAgICAgICAgICAgICAgaWYgKGFzRWxlbWVudC5jbGFzc05hbWUgPT09ICdzd3MteG1sLWVkaXRvci10ZXh0YXJlYScpIHtcclxuICAgICAgICAgICAgICAgIHJlYWNoZWRUb3AgPSB0cnVlO1xyXG4gICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBjb2xsZWN0Tm9kZXMudW5zaGlmdChuYW1lKTtcclxuICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICAgICAgbm9kZSA9IG5vZGUucGFyZW50RWxlbWVudDtcclxuICAgICAgICBpZiAobm9kZSA9PT0gdW5kZWZpbmVkIHx8IG5vZGUgPT0gbnVsbCkge1xyXG4gICAgICAgICAgcmVhY2hlZFRvcCA9IHRydWU7XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICAgIHRoaXMubm9kZXMgPSBjb2xsZWN0Tm9kZXM7XHJcbiAgICB9XHJcbiAgfVxyXG59XHJcbiJdfQ==