Created
April 14, 2017 23:12
-
-
Save mpelos/0eedd68627ab2c6b43401c283f80c071 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as $ from "jquery"; | |
import { module as angularModule } from "angular"; | |
import { contenteditable } from "../directives/contenteditable"; | |
import { Component } from "../models/component"; | |
import { idGenerator } from "../services/id_generator" | |
const moduleName = "directives.pageCanvas"; | |
export let pageCanvas = moduleName; | |
angularModule(moduleName, [contenteditable]).directive("pageCanvas", function($compile: angular.ICompileService) { | |
return { | |
restrict: "E", | |
scope: {}, | |
link: function(scope: angular.IScope, element: JQuery, attributes: angular.IAttributes) { | |
element = $(element[0]); | |
let componentStorage: Map<string, Component> = new Map(); | |
scope.$parent.$on("directives.stencilItem.startDragging", function( | |
event: angular.IAngularEvent, | |
draggingComponentModel: new ({ id: string }) => Component | |
) { | |
let component: Component = new draggingComponentModel({ | |
id: idGenerator.generate(componentStorage) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment