Skip to content

Instantly share code, notes, and snippets.

@mpelos
Created April 14, 2017 23:12
Show Gist options
  • Save mpelos/0eedd68627ab2c6b43401c283f80c071 to your computer and use it in GitHub Desktop.
Save mpelos/0eedd68627ab2c6b43401c283f80c071 to your computer and use it in GitHub Desktop.
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