imdone-core 1.43.5 → 1.43.7
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.
- package/lib/plugins/plugin-manager.js +1 -1
- package/lib/project.js +14 -2
- package/lib/task.js +2 -6
- package/package.json +1 -1
|
@@ -264,7 +264,7 @@ module.exports = class PluginManager extends Emitter {
|
|
|
264
264
|
})
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
async onBeforeAddTask({path, list, content, tags, contexts, meta,
|
|
267
|
+
async onBeforeAddTask({path, list, content, tags, contexts, meta, useCardTemplate}) {
|
|
268
268
|
await this.eachPluginAsync(async ({ pluginInstance }) => {
|
|
269
269
|
try {
|
|
270
270
|
const pluginMods = await pluginInstance.onBeforeAddTask({path, list, content, tags, contexts, meta, useCardTemplate})
|
package/lib/project.js
CHANGED
|
@@ -411,17 +411,29 @@ module.exports = class WorkerProject extends Project {
|
|
|
411
411
|
this.emit('project.saveFile', { file: filePath, content })
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
-
|
|
414
|
+
/*
|
|
415
|
+
* @param {Object} opts - The options object
|
|
416
|
+
* @param {String} opts.list - The list name to add the card to
|
|
417
|
+
* @param {String} opts.path - The path to the file to add the card to
|
|
418
|
+
* @param {String} opts.template - The template to use for the new card
|
|
419
|
+
* @param {String} opts.title - The title of the new card
|
|
420
|
+
* @param {String} opts.comments - The comments to add to the new card
|
|
421
|
+
* @param {Boolean} opts.emit - Whether to emit the new card event
|
|
422
|
+
*/
|
|
423
|
+
newCard({ list, path, template, title, comments, emit = true }) {
|
|
415
424
|
if (path) {
|
|
416
425
|
path = this.getFullPath(path)
|
|
417
426
|
if (!fileGateway.existsSync(path)) {
|
|
418
427
|
fileGateway.writeFileSync(path, '')
|
|
419
428
|
}
|
|
420
|
-
}
|
|
429
|
+
} // TODO: Need a way to handle new cards using new fie for each card
|
|
430
|
+
else {
|
|
421
431
|
path = this.getFullPath(this.getNewCardsFile({title}))
|
|
422
432
|
}
|
|
423
433
|
const stat = fileGateway.statSync(path)
|
|
424
434
|
if (!template) template = this.getNewCardTemplate(path, stat)
|
|
435
|
+
|
|
436
|
+
if (comments) template = Task.addToLastCommentInContent(template, comments, this.config.isMetaNewLine())
|
|
425
437
|
|
|
426
438
|
const data = {
|
|
427
439
|
list,
|
package/lib/task.js
CHANGED
|
@@ -291,19 +291,15 @@ Task.MetaRegExp = new RegExp(
|
|
|
291
291
|
)
|
|
292
292
|
Task.getMetaRegExp = function (config) {
|
|
293
293
|
return new RegExp(
|
|
294
|
-
`(^|\\s)([a-zA-Z-_]+?)${config.getMetaSep()}(?!\\/\\/)([${
|
|
294
|
+
`(^|\\s)([a-zA-Z-_]+?)${config.getMetaSep()}(?!\\*+)(?!\\/\\/)([${
|
|
295
295
|
Task.AnyLanguageGroup
|
|
296
296
|
}${Task.EmojiGroup}]+)`,
|
|
297
297
|
'gu'
|
|
298
298
|
)
|
|
299
299
|
}
|
|
300
|
-
Task.MetaRegExpQuotes = new RegExp(
|
|
301
|
-
`(^|\\s)([a-zA-Z-_]+?):"((?:""|[^"]|[${Task.AnyLanguageGroup}${Task.EmojiGroup}])*)"`,
|
|
302
|
-
'gu'
|
|
303
|
-
)
|
|
304
300
|
Task.getMetaRegExpQuotes = function (config) {
|
|
305
301
|
return new RegExp(
|
|
306
|
-
`(^|\\s)([a-zA-Z-_]+?)${config.getMetaSep()}"((?${config.getMetaSep()}""|[^"]|[${
|
|
302
|
+
`(^|\\s)([a-zA-Z-_]+?)${config.getMetaSep()}(?!\\*+)"((?${config.getMetaSep()}""|[^"]|[${
|
|
307
303
|
Task.AnyLanguageGroup
|
|
308
304
|
}${Task.EmojiGroup}])*)"`,
|
|
309
305
|
'gu'
|