@concretecms/bedrock 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,6 @@ $(window).on('mousemove keydown keyup', function() {
16
16
  cache: false,
17
17
  dataType: 'json',
18
18
  type: 'GET',
19
- url: CCM_DISPATCHER_FILENAME + '/ccm/system/heartbeat'
19
+ url: CCM_DISPATCHER_FILENAME + '/ccm/system/heartbeat?cID=' + (Number(window.CCM_CID) || '')
20
20
  })
21
21
  })
@@ -33,20 +33,48 @@
33
33
  },
34
34
  init: function() {
35
35
  if (options.selected) {
36
- if (options.mode == 'multiple') {
37
- $.each(options.selected, function(i, cID) {
38
- var node = $.ui.fancytree.getTree(my.$element.find('.ccm-sitemap-tree')).getNodeByKey(String(cID))
36
+ var tree = $.ui.fancytree.getTree(my.$element.find('.ccm-sitemap-tree'))
37
+
38
+ var paths
39
+ if (options.mode === 'multiple') {
40
+ paths = options.selectedPath.map(pathGroup => pathGroup.map(String))
41
+ } else {
42
+ paths = []
43
+ paths.push(options.selectedPath.map(String))
44
+ }
45
+
46
+ var promise = Promise.resolve()
47
+
48
+ paths.forEach(function(pathGroup) {
49
+ pathGroup.forEach(function(nodeKey) {
50
+ promise = promise.then(function() {
51
+ var node = tree.getNodeByKey(nodeKey)
52
+ if (node) {
53
+ return node.setExpanded(true)
54
+ }
55
+ })
56
+ })
57
+
58
+ promise = promise.then(function() {
59
+ return Promise.resolve()
60
+ })
61
+ })
62
+
63
+ promise.then(function() {
64
+ if (options.mode === 'multiple') {
65
+ options.selected.forEach(function(cID) {
66
+ var node = tree.getNodeByKey(String(cID))
67
+ if (node) {
68
+ node.setSelected(true)
69
+ }
70
+ })
71
+ } else {
72
+ var node = tree.getNodeByKey(String(options.selected))
39
73
  if (node) {
40
74
  node.setSelected(true)
41
75
  }
42
- })
43
- } else {
44
- var tree = $.ui.fancytree.getTree(my.$element.find('.ccm-sitemap-tree'))
45
- var node = tree.getNodeByKey(String(options.selected))
46
- if (node) {
47
- node.setSelected(true)
48
76
  }
49
- }
77
+ })
50
78
  }
51
79
  },
52
80
  onSelectNode: function(node, flag) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@concretecms/bedrock",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "The asset framework and dependencies for Concrete CMS.",
5
5
  "scripts": {
6
6
  "lint": "standardx \"**/*.{js,vue}\" && stylelint assets/**/*.{scss,vue}",