card-mod-ace_editor 0.13.1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,56 @@
1
+ decko.addEditor(
2
+ '.ace-editor-textarea',
3
+ ->
4
+ decko.initAce $(this),
5
+ ->
6
+ aceEditorContent this[0]
7
+ )
8
+
9
+ $.extend decko,
10
+ setAceConfig: (string) ->
11
+ setter = ->
12
+ try
13
+ $.parseJSON string
14
+ catch
15
+ {}
16
+ decko.aceConfig = setter()
17
+
18
+ configAceEditor: (editor, mode) ->
19
+ conf = {
20
+ showGutter: true,
21
+ theme: "ace/theme/github",
22
+ printMargin: false,
23
+ tabSize: 2,
24
+ useSoftTabs: true,
25
+ maxLines: 30
26
+ }
27
+ hard_conf = {
28
+ mode: "ace/mode/" + mode
29
+ }
30
+ user_conf = if decko.aceConfig? then decko.aceConfig else {}
31
+ $.extend conf, user_conf['default'], user_conf[mode], hard_conf
32
+ editor.setOptions conf
33
+
34
+ initAce: (textarea) ->
35
+ mode = textarea.attr "data-ace-mode"
36
+
37
+ unless mode
38
+ textarea.autosize()
39
+ return
40
+ editDiv = $("<div>",
41
+ position: "absolute"
42
+ width: "auto"
43
+ height: textarea.height()
44
+ ).insertBefore(textarea)
45
+ textarea.css "visibility", "hidden"
46
+ textarea.css "height", "0px"
47
+ ace.config.set('basePath', decko.path('mod/ace_editor/ace'))
48
+ editor = ace.edit(editDiv[0])
49
+ editor.getSession().setValue textarea.val()
50
+ decko.configAceEditor(editor, mode)
51
+ return
52
+
53
+ aceEditorContent = (element) ->
54
+ ace_div = $(element).siblings(".ace_editor")
55
+ editor = ace.edit(ace_div[0])
56
+ editor.getSession().getValue()
@@ -1,3 +1,6 @@
1
+ basket[:list_input_options] << "ace editor"
2
+ basket[:script_config][:ace] = "setAceConfig"
3
+
1
4
  format :html do
2
5
  def ace_editor_input
3
6
  text_area :content, rows: 5,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-ace_editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-08-06 00:00:00.000000000 Z
13
+ date: 2021-12-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.103.1
21
+ version: 1.104.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.103.1
28
+ version: 1.104.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: card-mod-edit
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.13.1
35
+ version: 0.14.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.13.1
42
+ version: 0.14.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: card-mod-script
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.13.1
49
+ version: 0.14.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.13.1
56
+ version: 0.14.0
57
57
  description: ''
58
58
  email:
59
59
  - info@decko.org
@@ -61,9 +61,11 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - README.md
65
+ - assets/script/script_ace.js
66
+ - assets/script/script_ace_config.js.coffee
64
67
  - db/migrate_core_cards/20160804112538_add_ace_cards.rb
65
68
  - db/migrate_core_cards/20180805112548_delete_ace_help_card.rb
66
- - file/mod_ace_editor_script_local_machine_output/file.js
67
69
  - public/ace/ext-beautify.js
68
70
  - public/ace/ext-elastic_tabstops_lite.js
69
71
  - public/ace/ext-emmet.js
@@ -434,8 +436,6 @@ files:
434
436
  - public/ace/worker-xquery.js
435
437
  - set/all/ace_editor.rb
436
438
  - set/self/ace.rb
437
- - set/self/script_ace.rb
438
- - set/self/script_ace_config.rb
439
439
  homepage: https://decko.org
440
440
  licenses:
441
441
  - GPL-3.0
@@ -461,7 +461,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
461
461
  - !ruby/object:Gem::Version
462
462
  version: '0'
463
463
  requirements: []
464
- rubygems_version: 3.1.6
464
+ rubygems_version: 3.2.15
465
465
  signing_key:
466
466
  specification_version: 4
467
467
  summary: Ace editor