diff options
Diffstat (limited to 'js/panels')
-rwxr-xr-x | js/panels/components-panel.reel/components-panel.js | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/js/panels/components-panel.reel/components-panel.js b/js/panels/components-panel.reel/components-panel.js index 79eac37b..4169423b 100755 --- a/js/panels/components-panel.reel/components-panel.js +++ b/js/panels/components-panel.reel/components-panel.js | |||
@@ -317,81 +317,77 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
317 | 317 | ||
318 | switch(name) { | 318 | switch(name) { |
319 | case "anchor": | 319 | case "anchor": |
320 | el = NJUtils.makeNJElement("a", "Anchor", "component"); | 320 | el = document.application.njUtils.make("a", null, this.application.ninja.currentDocument); |
321 | el.elementModel.pi = "AnchorPi"; | 321 | document.application.njUtils.createModelForComponent(el, "Anchor"); |
322 | el.setAttribute("href", "http://www.motorola.com"); | 322 | el.setAttribute("href", "http://www.motorola.com"); |
323 | el.innerHTML = "link"; | 323 | el.innerHTML = "link"; |
324 | break; | 324 | break; |
325 | case "button": | 325 | case "button": |
326 | el = NJUtils.makeNJElement(name, "Button", "component"); | 326 | el = document.application.njUtils.make(name, null, this.application.ninja.currentDocument); |
327 | el.elementModel.pi = "ButtonPi"; | 327 | document.application.njUtils.createModelForComponent(el, "Button"); |
328 | el.setAttribute("type", "button"); | 328 | el.setAttribute("type", "button"); |
329 | el.innerHTML = "Button"; | 329 | el.innerHTML = "Button"; |
330 | break; | 330 | break; |
331 | case "checkbox": | 331 | case "checkbox": |
332 | el = NJUtils.makeNJElement("input", "Checkbox", "component"); | 332 | el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); |
333 | el.elementModel.pi = "CheckboxPi"; | 333 | document.application.njUtils.createModelForComponent(el, "Checkbox"); |
334 | el.setAttribute("type", "checkbox"); | 334 | el.setAttribute("type", "checkbox"); |
335 | break; | 335 | break; |
336 | case "imageComponent": | 336 | case "imageComponent": |
337 | el = NJUtils.makeNJElement("image", "Image", "component"); | 337 | el = document.application.njUtils.make("image", null, this.application.ninja.currentDocument); |
338 | el.elementModel.pi = "ImagePi"; | 338 | document.application.njUtils.createModelForComponent(el, "Image"); |
339 | el.setAttribute("width", 200); | 339 | el.setAttribute("width", 200); |
340 | el.setAttribute("height", 200); | 340 | el.setAttribute("height", 200); |
341 | break; | 341 | break; |
342 | case "numberInput": | 342 | case "numberInput": |
343 | el = NJUtils.makeNJElement("input", "Number Input", "component"); | 343 | el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); |
344 | el.elementModel.pi = "NumberInputPi"; | 344 | document.application.njUtils.createModelForComponent(el, "Number Input"); |
345 | el.setAttribute("type", "number"); | 345 | el.setAttribute("type", "number"); |
346 | break; | 346 | break; |
347 | case "select": | 347 | case "select": |
348 | el = NJUtils.makeNJElement("select", "Select", "component"); | 348 | el = document.application.njUtils.make("select", null, this.application.ninja.currentDocument); |
349 | el.elementModel.pi = "SelectInputPi"; | 349 | document.application.njUtils.createModelForComponent(el, "Select"); |
350 | break; | 350 | break; |
351 | case "radioButton": | 351 | case "radioButton": |
352 | el = NJUtils.makeNJElement("input", "Radio Button", "component"); | 352 | el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); |
353 | el.elementModel.pi = "RadioButtonPi"; | 353 | document.application.njUtils.createModelForComponent(el, "Radio Button"); |
354 | el.setAttribute("type", "radio"); | 354 | el.setAttribute("type", "radio"); |
355 | break; | 355 | break; |
356 | case "rangeInput": | 356 | case "rangeInput": |
357 | el = NJUtils.makeNJElement("input", "Range Input", "component"); | 357 | el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); |
358 | el.elementModel.pi = "RangeInputPi"; | 358 | document.application.njUtils.createModelForComponent(el, "Range Input"); |
359 | el.setAttribute("type", "range"); | 359 | el.setAttribute("type", "range"); |
360 | break; | 360 | break; |
361 | case "textfield": | 361 | case "textfield": |
362 | case "searchfield": | 362 | case "searchfield": |
363 | el = NJUtils.makeNJElement("input", "Textfield", "component"); | 363 | el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); |
364 | el.elementModel.pi = "TextfieldPi"; | 364 | document.application.njUtils.createModelForComponent(el, "Textfield"); |
365 | el.setAttribute("type", "text"); | 365 | el.setAttribute("type", "text"); |
366 | break; | 366 | break; |
367 | case "textarea": | 367 | case "textarea": |
368 | el = NJUtils.makeNJElement("textarea", "TextArea", "component"); | 368 | el = document.application.njUtils.make("textarea", null, this.application.ninja.currentDocument); |
369 | el.elementModel.pi = "TextareaPi"; | 369 | document.application.njUtils.createModelForComponent(el, "TextArea"); |
370 | break; | 370 | break; |
371 | case "toggleButton": | 371 | case "toggleButton": |
372 | el = NJUtils.makeNJElement("button", "Toggle Button", "component"); | 372 | el = document.application.njUtils.make("button", null, this.application.ninja.currentDocument); |
373 | el.elementModel.pi = "ToggleButtonPi"; | 373 | document.application.njUtils.createModelForComponent(el, "Toggle Button"); |
374 | el.innerHTML = "Off"; | 374 | el.innerHTML = "Off"; |
375 | break; | 375 | break; |
376 | case "map": | 376 | case "map": |
377 | el = NJUtils.makeNJElement("div", "Map", "component"); | 377 | el = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); |
378 | el.elementModel.pi = "MapPi"; | 378 | document.application.njUtils.createModelForComponent(el, "Map"); |
379 | el.elementModel.isComponent = true; | ||
380 | break; | 379 | break; |
381 | case "feedreader": | 380 | case "feedreader": |
382 | el = NJUtils.makeNJElement("div", "Feed Reader", "component"); | 381 | el = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); |
383 | el.elementModel.pi = "FeedReaderPi"; | 382 | document.application.njUtils.createModelForComponent(el, "Feed Reader"); |
384 | el.elementModel.isComponent = true; | ||
385 | break; | 383 | break; |
386 | case "picasa-carousel": | 384 | case "picasa-carousel": |
387 | el = NJUtils.makeNJElement("div", "Picasa Carousel", "component"); | 385 | el = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); |
388 | el.elementModel.pi = "PicasaCarouselPi"; | 386 | document.application.njUtils.createModelForComponent(el, "Picasa Carousel"); |
389 | el.elementModel.isComponent = true; | ||
390 | break; | 387 | break; |
391 | case "youtube-channel": | 388 | case "youtube-channel": |
392 | el = NJUtils.makeNJElement("div", "Youtube Channel", "component"); | 389 | el = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); |
393 | el.elementModel.pi = "YoutubeChannelPi"; | 390 | document.application.njUtils.createModelForComponent(el, "Youtube Channel"); |
394 | el.elementModel.isComponent = true; | ||
395 | break; | 391 | break; |
396 | 392 | ||
397 | } | 393 | } |