Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bert Hoorne 15 posts 55 karma points
    Jun 20, 2015 @ 20:51
    Bert Hoorne
    0

    editorState.current is always null custom plugin

    Hi,

    I am creating a custom plugin for Umbraco 7, I need to find the parentId via my javascript, so I tried using editorState.current, but this is always null. editorState is correctly initialized, but the property current is always null.

    angular.module("umbraco").controller("CatalogueEditController",
    function ($scope, editorState) {
        console.log(editorState.current);
    

    Does someone knows what I am doing wrong?

    Thanks! :)

  • Casper Andersen 126 posts 508 karma points
    Jun 21, 2015 @ 13:04
    Casper Andersen
    0

    Is current not supposed to be with a capital C as in Current ? i am guessing it is a dynamic property so you have no intellisense

  • Bert Hoorne 15 posts 55 karma points
    Jun 21, 2015 @ 13:08
    Bert Hoorne
    0

    Hi, sorry, its indeed whitout a capital C, I tried with both though, just a bad habit to start with a capital letter. Still the property is null :(

  • Casper Andersen 126 posts 508 karma points
    Jun 21, 2015 @ 13:15
    Casper Andersen
    0

    Try and debug in visual studio. Set a break point when u initialize angular.module and then when you load in your editorState, check it and make sure it is sending some value and that editorState is actually receiving those values, also what do you want with current, if you want the id why write editorState.current.id ?

  • Bert Hoorne 15 posts 55 karma points
    Jun 21, 2015 @ 13:19
    Bert Hoorne
    0

    editorState.current is always null, so I cannot get the Id :). I actually need the parent id. I already debugged in my VS. Editorstate is correctly initialized, but the current property is always null, I tried finding where this property is set, but no luck.

  • Casper Andersen 126 posts 508 karma points
    Jun 21, 2015 @ 13:28
    Casper Andersen
    0

    According to http://umbraco.github.io/Belle/#/api/umbraco.services.editorState editorState is just the state of the Editor... Funny enough :P that is passed in, so not anything you and control. But i also read that it is a read only property, so what happens if you try and assign it to a variable, and then console.log that value ?

  • Bert Hoorne 15 posts 55 karma points
    Jun 21, 2015 @ 13:31
    Bert Hoorne
    0

    Already did that too, found a topic that a person added the editorState to $scope.editorState and then did console.log to the $scope.editorState property, ,but again, no luck there too :/. I added some extra query parameters for now, but I would love to get my data from the editorState and not url parsing

  • Janus Kamp Hansen 16 posts 153 karma points
    Jan 01, 2017 @ 16:41
    Janus Kamp Hansen
    0

    Little late, but anyway...

    You can use:

    $scope.dialogOptions.currentNode
    
Please Sign in or register to post replies

Write your reply to:

Draft