dockview
Version:
Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support
116 lines • 4.95 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DragHandler = void 0;
var dom_1 = require("../dom");
var events_1 = require("../events");
var lifecycle_1 = require("../lifecycle");
var DragHandler = /** @class */ (function (_super) {
__extends(DragHandler, _super);
function DragHandler(el) {
var _this = _super.call(this) || this;
_this.el = el;
_this.iframes = [];
_this._onDragStart = new events_1.Emitter();
_this.onDragStart = _this._onDragStart.event;
_this.configure();
return _this;
}
DragHandler.prototype.configure = function () {
var _this = this;
this.addDisposables((0, events_1.addDisposableListener)(this.el, 'dragstart', function (event) {
var e_1, _a;
var _b;
_this.iframes = __spreadArray(__spreadArray([], __read((0, dom_1.getElementsByTagName)('iframe')), false), __read((0, dom_1.getElementsByTagName)('webview')), false);
try {
for (var _c = __values(_this.iframes), _d = _c.next(); !_d.done; _d = _c.next()) {
var iframe = _d.value;
iframe.style.pointerEvents = 'none';
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
_this.el.classList.add('dragged');
setTimeout(function () { return _this.el.classList.remove('dragged'); }, 0);
(_b = _this.disposable) === null || _b === void 0 ? void 0 : _b.dispose();
_this.disposable = _this.getData();
}), (0, events_1.addDisposableListener)(this.el, 'dragend', function (ev) {
var e_2, _a;
var _b;
try {
for (var _c = __values(_this.iframes), _d = _c.next(); !_d.done; _d = _c.next()) {
var iframe = _d.value;
iframe.style.pointerEvents = 'auto';
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_2) throw e_2.error; }
}
_this.iframes = [];
(_b = _this.disposable) === null || _b === void 0 ? void 0 : _b.dispose();
_this.disposable = undefined;
}));
};
return DragHandler;
}(lifecycle_1.CompositeDisposable));
exports.DragHandler = DragHandler;
//# sourceMappingURL=abstractDragHandler.js.map