deckar01-task_list 2.1.0 → 2.2.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
  SHA1:
3
- metadata.gz: 81348d00f04d1dfe35d04ed3cf61be363e29efcc
4
- data.tar.gz: 1e42721319fe2d4471b3f1326bc3e18926d4eb35
3
+ metadata.gz: 3001d6279d0f9902b6c3a716160cc4461ebd0f5d
4
+ data.tar.gz: a430a31c65d93c60d990a28da605034769c28ed8
5
5
  SHA512:
6
- metadata.gz: e5cef82b7723332356586a61403ac7e0346af757b46adae5a0442fe4853b76acdf1ff2fa57b8f45e3c55c884e94ca3c5723aa010f037beba7726b2b66b5eeb9f
7
- data.tar.gz: 3ea02e2a2f9c7cd3f7925b786f910009c6b78baa63c563a95f5f32ef3ab89932636638c8c38a33517b3d1678d5f8d4a5787608e6c034529b1ea808fd82ce5b95
6
+ metadata.gz: a520d9514d2b60e807a3b089934de349a12d163dab3dbb9cdefa869759e7954dfeebdf3f3dcebff7f08ec689e4b7b9ebefde455db8d375bb7849033f4e6bcc74
7
+ data.tar.gz: 1d6b284440eead3abbfb4d8d8466bcd96e5ad18d0c50794c5a8dfd14326f697561cd25b19fdac6ac44876daf50f421d85ec94b65edb43e5b5751a870588e0d29
@@ -149,12 +149,18 @@ class TaskList
149
149
  @field.dispatchEvent changeEvent
150
150
 
151
151
  unless changeEvent.defaultPrevented
152
- @field.value = TaskList.updateSource(@field.value, index, item.checked)
152
+ { result, lineNumber, lineSource } =
153
+ TaskList.updateSource(@field.value, index, item.checked)
154
+
155
+ @field.value = result
153
156
  changeEvent = createEvent 'change'
154
157
  @field.dispatchEvent changeEvent
155
- changedEvent = createEvent 'tasklist:changed',
158
+ changedEvent = createEvent 'tasklist:changed', {
156
159
  index: index
157
160
  checked: item.checked
161
+ lineNumber: lineNumber
162
+ lineSource: lineSource
163
+ }
158
164
  @field.dispatchEvent changedEvent
159
165
 
160
166
  # Static interface
@@ -220,7 +226,10 @@ class TaskList
220
226
  split("\n")
221
227
  index = 0
222
228
  inCodeBlock = false
223
- result = for line in source.split("\n")
229
+ lineNumber
230
+ lineSource
231
+
232
+ result = for line, i in source.split("\n")
224
233
  if inCodeBlock
225
234
  # Lines inside of a code block are ignored.
226
235
  if line.match(@endFencesPattern)
@@ -232,13 +241,19 @@ class TaskList
232
241
  else if line in clean && line.match(@itemPattern)
233
242
  index += 1
234
243
  if index == itemIndex
244
+ lineNumber = i + 1
245
+ lineSource = line
235
246
  line =
236
247
  if checked
237
248
  line.replace(@incompletePattern, @complete)
238
249
  else
239
250
  line.replace(@completePattern, @incomplete)
240
251
  line
241
- result.join("\n")
252
+ return {
253
+ result: result.join("\n")
254
+ lineNumber: lineNumber
255
+ lineSource: lineSource
256
+ }
242
257
 
243
258
  if typeof jQuery != 'undefined'
244
259
  jQuery.fn.taskList = (method) ->
@@ -1,3 +1,3 @@
1
1
  class TaskList
2
- VERSION = [2, 1, 0].join('.')
2
+ VERSION = [2, 2, 0].join('.')
3
3
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deckar01-task_list",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Markdown TaskList components",
5
5
  "main": "dist/task_list.js",
6
6
  "directories": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deckar01-task_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Deckard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-22 00:00:00.000000000 Z
12
+ date: 2019-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: html-pipeline