Skip to content

Commit a372f06

Browse files
committed
1.0.16 - fix symbol insertion for Sketch 50
1 parent 09b6396 commit a372f06

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

library-symbol-replacer.sketchplugin/Contents/Sketch/manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "Library Symbol Replacer",
33
"identifier": "com.zeroheight.library-symbol-replacer",
4-
"version": "1.0.15",
4+
"version": "1.0.16",
55
"description": "replace local symbols with library symbols",
66
"authorEmail": "[email protected]",
77
"author": "zeroheight team",
88
"appcast": "https://api.sketchpacks.com/v1/plugins/com.zeroheight.library-symbol-replacer/appcast",
99
"updateURL": "https://github.com/zeroheight/library-symbol-replacer",
10-
"compatibleVersion": 48,
10+
"compatibleVersion": 50,
1111
"bundleVersion": 1,
1212
"commands": [{
1313
"script": "script.js",

library-symbol-replacer.sketchplugin/Contents/Sketch/script.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,19 @@ var replaceFromUrl = function(context,url){
8787
var obj = imports[i];
8888

8989
// import the symbol into the document
90-
var importedSymbol = librariesController().importForeignSymbol_fromLibrary_intoDocument_(
91-
obj.librarySymbol, library, documentData);
90+
var importedSymbol = null;
91+
92+
if (MSApplicationMetadata.metadata().appVersion >= 50) {
93+
var shareableObjectReference = MSShareableObjectReference
94+
.referenceForShareableObject_inLibrary(obj.librarySymbol, library);
95+
importedSymbol = AppController.sharedInstance().librariesController()
96+
.importShareableObjectReference_intoDocument(
97+
shareableObjectReference, documentData);
98+
} else {
99+
importedSymbol = AppController.sharedInstance().librariesController()
100+
.importForeignSymbol_fromLibrary_intoDocument_(
101+
symbol, library, documentData);
102+
}
92103

93104
obj.importedSymbol = importedSymbol.symbolMaster();
94105

0 commit comments

Comments
 (0)