Skip to content

No function named onOpenDocument in Sketch Panel UI Framework #5

Description

@eldos-dl

In the default code generated by Sketch Panel UI Framework, there is no onOpenDocument function in Panel/Panel.js while we have default onStartup and onSelectionChanged functions.

    "handlers" : {
        "actions" : {
            "Startup" : "onStartup",
            "OpenDocument":"onOpenDocument",
            "SelectionChanged.finish" : "onSelectionChanged"
        }
    }
}
]
*/

var onStartup = function(context) {
  var testing_FrameworkPath = testing_FrameworkPath || COScript.currentCOScript().env().scriptURL.path().stringByDeletingLastPathComponent().stringByDeletingLastPathComponent();
  var testing_Log = testing_Log || log;
  (function() {
    var mocha = Mocha.sharedRuntime();
    var frameworkName = "testing";
    var directory = testing_FrameworkPath;
    if (mocha.valueForKey(frameworkName)) {
      testing_Log("😎 loadFramework: `" + frameworkName + "` already loaded.");
      return true;
    } else if ([mocha loadFrameworkWithName:frameworkName inDirectory:directory]) {
      testing_Log("✅ loadFramework: `" + frameworkName + "` success!");
      mocha.setValue_forKey_(true, frameworkName);
      return true;
    } else {
      testing_Log("❌ loadFramework: `" + frameworkName + "` failed!: " + directory + ". Please define testing_FrameworkPath if you're trying to @import in a custom plugin");
      return false;
    }
  })();
};

var onSelectionChanged = function(context) {
  testing.onSelectionChanged(context);
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions