gobstones-blockly 0.10.3 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a85dadb56aeedaf4405884ad24dedc8145d62b9665be27b3bb0bc6518010a06
4
- data.tar.gz: ba06f79a4e592c519a01813a56f04ac2cb4a6f672feef76913a069481245f3ea
3
+ metadata.gz: a5ce31882d527f3ac925264c5e88f37eb18f15ddbd66f1f0e2f55700e344b78a
4
+ data.tar.gz: 1ddacf0a781f3b21fe9b52ae430ba4e029fa5ae6baefcfc877239d7e1fa6baa9
5
5
  SHA512:
6
- metadata.gz: ef4884a64413fac463154ebeacccca243373dbe74e1f9ff47e6bcdb31c27fe26e617c60e2ed6701274cc7916dcb2dee3532d0c028ce751b6b2419df932c4571d
7
- data.tar.gz: 4a3366db0bff260ab3fd41946033dae0847a766c16460bd32892eb0d577ace4957211d8f5eb49ee14a7deb0bad783420773daee51d24acd2bec22cf4a064f203
6
+ metadata.gz: 06b682643c09d71b04dd289da591e7e2702ad179925de0bb1f96444e625b791d34b9ef3207557398cb959b03903ad0c77086b8132a990582dcdbbc927f62fed9
7
+ data.tar.gz: ab939e861a409770e85008e4e0066f7daeadbc711a896ebb025f29f4506be20638479ea5d9be1d7f61e92c9443c3a2977b71131d1472272769d7a2c458d579ab
@@ -5659,6 +5659,9 @@ Blockly.ErrorInforming.CssContent = [
5659
5659
  ];</script>
5660
5660
 
5661
5661
  <script>
5662
+ const BLOCKLY_PRIMITIVE_PROCEDURES = "Procedimientos primitivos";
5663
+ const BLOCKLY_PRIMITIVE_FUNCTIONS = "Funciones primitivas";
5664
+
5662
5665
  Polymer({
5663
5666
  is: 'gs-element-blockly',
5664
5667
 
@@ -5745,6 +5748,14 @@ Blockly.ErrorInforming.CssContent = [
5745
5748
  type: String,
5746
5749
  value: "../bower_components/blockly-package/media/"
5747
5750
  },
5751
+
5752
+ /*
5753
+ * `readOnly` Use blockly in readOnly mode.
5754
+ */
5755
+ readOnly: {
5756
+ type: Boolean,
5757
+ value: false
5758
+ },
5748
5759
  },
5749
5760
 
5750
5761
  _onPrimitiveProceduresChange: function() {
@@ -5797,13 +5808,12 @@ Blockly.ErrorInforming.CssContent = [
5797
5808
  /**
5798
5809
  * Retorna el arbol por defecto de bloques y categorias
5799
5810
  */
5800
- _defaultToolboxTree : function() {
5811
+ _defaultToolboxTree : function(toolboxXML) {
5801
5812
  const primitiveProcedures = this._getPrimitiveNames(this.primitiveProcedures);
5802
5813
  const primitiveFunctions = this._getPrimitiveNames(this.primitiveFunctions);
5803
5814
 
5804
5815
  let tree = []
5805
- let toolboxDefault = this.$$('#toolbox');
5806
- let toolboxDefaultLines = toolboxDefault.innerHTML.split("\n");
5816
+ let toolboxDefaultLines = (toolboxXML || this.$$('#toolbox').innerHTML).split("\n");
5807
5817
  let ignore_last = false;
5808
5818
  let parent = tree;
5809
5819
  let stack = [];
@@ -5821,9 +5831,9 @@ Blockly.ErrorInforming.CssContent = [
5821
5831
  else if(line.indexOf('<category') >= 0) {
5822
5832
  let m = line.match('name="([^"]*)"')
5823
5833
  if(m.length == 2 && (
5824
- (m[1] == 'Procedimientos primitivos' && primitiveProcedures && primitiveProcedures.length > 0) ||
5825
- (m[1] == 'Funciones primitivas' && primitiveFunctions && primitiveFunctions.length > 0) ||
5826
- (m[1] != 'Procedimientos primitivos' && m[1] != 'Funciones primitivas'))) {
5834
+ (m[1] == BLOCKLY_PRIMITIVE_PROCEDURES && primitiveProcedures && primitiveProcedures.length > 0) ||
5835
+ (m[1] == BLOCKLY_PRIMITIVE_FUNCTIONS && primitiveFunctions && primitiveFunctions.length > 0) ||
5836
+ (m[1] != BLOCKLY_PRIMITIVE_PROCEDURES && m[1] != BLOCKLY_PRIMITIVE_FUNCTIONS))) {
5827
5837
  parent.push({
5828
5838
  type: 'category',
5829
5839
  name: m[1],
@@ -5832,7 +5842,7 @@ Blockly.ErrorInforming.CssContent = [
5832
5842
  });
5833
5843
  stack.push(parent);
5834
5844
  parent = parent[parent.length - 1].child;
5835
- if(m[1] == 'Procedimientos primitivos')
5845
+ if(m[1] == BLOCKLY_PRIMITIVE_PROCEDURES)
5836
5846
  {
5837
5847
  for(var i in primitiveProcedures) {
5838
5848
  parent.push({
@@ -5841,7 +5851,7 @@ Blockly.ErrorInforming.CssContent = [
5841
5851
  });
5842
5852
  }
5843
5853
  }
5844
- if(m[1] == 'Funciones primitivas')
5854
+ if(m[1] == BLOCKLY_PRIMITIVE_FUNCTIONS)
5845
5855
  {
5846
5856
  for(var i in primitiveFunctions) {
5847
5857
  parent.push({
@@ -5891,7 +5901,7 @@ Blockly.ErrorInforming.CssContent = [
5891
5901
  let tree = this._defaultToolboxTree();
5892
5902
  let toolbox = [];
5893
5903
 
5894
- if(this.toolbox) {
5904
+ if (this.toolbox) {
5895
5905
  let visibles = this._homogenizeIDs(this.toolbox.visible);
5896
5906
  let disabled = this._homogenizeIDs(this.toolbox.disabled);
5897
5907
  if(visibles.length > 0) {
@@ -5936,8 +5946,28 @@ Blockly.ErrorInforming.CssContent = [
5936
5946
  }
5937
5947
  marcarDisabled(toolbox);
5938
5948
 
5939
- }
5940
- else {
5949
+ const addCustomActions = (type, categoryName) => {
5950
+ if (this.toolbox[type]) {
5951
+ const customTree = this._defaultToolboxTree(this.toolbox[type]);
5952
+
5953
+ const addCustomActionsChilds = (ttree) => {
5954
+ for (var item of ttree) {
5955
+ if (item.type !== "category") continue;
5956
+
5957
+ if (item.name === BLOCKLY_PRIMITIVE_PROCEDURES)
5958
+ item.child = customTree;
5959
+ else
5960
+ addCustomActionsChilds(item.child);
5961
+ }
5962
+ };
5963
+
5964
+ addCustomActionsChilds(toolbox);
5965
+ }
5966
+ };
5967
+
5968
+ addCustomActions("primitiveProcedures", BLOCKLY_PRIMITIVE_PROCEDURES);
5969
+ addCustomActions("primitiveFunctions", BLOCKLY_PRIMITIVE_FUNCTIONS);
5970
+ } else {
5941
5971
  toolbox = tree;
5942
5972
  }
5943
5973
 
@@ -6329,6 +6359,7 @@ Blockly.ErrorInforming.CssContent = [
6329
6359
  horizontalLayout: false,
6330
6360
  collapse: true,
6331
6361
  css: true,
6362
+ readOnly: this.readOnly,
6332
6363
  zoom: {
6333
6364
  controls: true,
6334
6365
  wheel: true
@@ -1,5 +1,5 @@
1
1
  module Gobstones
2
2
  module Blockly
3
- VERSION = "0.10.3"
3
+ VERSION = "0.11.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobstones-blockly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler