diff --git a/CHANGELOG.md b/CHANGELOG.md index fa8523e493..54cf0f8d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,4 @@ # Changelog - All (hopefully) notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), @@ -9,6 +8,20 @@ This project does not yet adheres to [Semantic Versioning](https://semv \- +## [0.22.3] - 2021-12-03 + +### Added +- Ability to inject links into Content via hot-key searching [#1674] + +### Changed +- Upgraded to Postgres 12 in Docker Compose development environment. Postgres 10 container and volume are still present to allow for automatic data migration. + +### Fixed +- Identifier form elements on SQED breakdown [#2700] + +[#2700]: https://github.com/SpeciesFileGroup/taxonworks/issues/2700 +[#1674]: https://github.com/SpeciesFileGroup/taxonworks/issues/1674 + ## [0.22.2] - 2021-12-02 ### Changed @@ -2126,7 +2139,8 @@ This project does not yet adheres to [Semantic Versioning](https://semv [#1532]: https://github.com/SpeciesFileGroup/taxonworks/issues/1532 -[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.2...development +[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.3...development +[0.22.3]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.2...v0.22.3 [0.22.2]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.1...v0.22.2 [0.22.1]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.0...v0.22.1 [0.22.0]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.21.3...v0.22.0 diff --git a/app/assets/stylesheets/views/tasks/content/editor/index.scss b/app/assets/stylesheets/views/tasks/content/editor/index.scss index 4e43e558c4..fd0052ea7a 100644 --- a/app/assets/stylesheets/views/tasks/content/editor/index.scss +++ b/app/assets/stylesheets/views/tasks/content/editor/index.scss @@ -63,17 +63,21 @@ height: 30px; } .figures-delete { - background-image: image-url("w_trash.svg"); position: absolute; top: 12px; right: 12px; } .figures-edit { - background-image: image-url("w_pencil.svg"); position: absolute; - bottom: -15px; + bottom: -12px; right: 12px; } + + .figures-link { + position: absolute; + top: 12px; + left: 24px; + } } } diff --git a/app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb b/app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb index 0222647e1d..27c55ad8f2 100644 --- a/app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb +++ b/app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb @@ -9,7 +9,7 @@ def todo_map @sqed_depictions = SqedDepiction.where(project_id: sessions_current_project_id).order(:id).page(params[:page]).per(100) end - # GET /tasks/accession/breakdown/depiction/:id # id is a collection_object_id + # GET /tasks/accession/breakdown/depiction/:id # id is a collection_object_id !! def index @result = SqedToTaxonworks::Result.new( depiction_id: @sqed_depiction.depiction.id, diff --git a/app/javascript/vue/components/markdown-editor.vue b/app/javascript/vue/components/markdown-editor.vue index a930eb6eea..a09804b5aa 100644 --- a/app/javascript/vue/components/markdown-editor.vue +++ b/app/javascript/vue/components/markdown-editor.vue @@ -54,6 +54,10 @@ export default { } }, + created () { + TW.workbench.keyboard.createLegend(`${GetOSKey()}+shift+l`, 'Open data links modal', 'Markdown editor') + }, + mounted () { this.initialize() }, @@ -66,12 +70,11 @@ export default { }, toolbar: ['bold', 'italic', 'code', 'heading', '|', 'quote', 'unordered-list', 'ordered-list', '|', 'link', 'table', 'preview', { name: 'width-auto', - action: (editor) => { - // this.openCustomLinks() + action: _ => { + this.openCustomLinks() }, - icon: 'Data links', - title: 'Data links', - disable: true + icon: 'Data links', + title: 'Data links' }] } Object.assign(configs, this.configs) @@ -83,6 +86,7 @@ export default { this.addPreviewClass(className) this.bindingEvents() }, + bindingEvents () { this.simplemde.codemirror.on('change', () => { this.$emit('update:modelValue', this.simplemde.value()) @@ -107,6 +111,7 @@ export default { }, 300) }) }, + addPreviewClass (className) { const wrapper = this.simplemde.codemirror.getWrapperElement() const preview = document.createElement('div') @@ -114,15 +119,21 @@ export default { preview.className = `editor-preview ${className}` wrapper.appendChild(preview) }, + setCustomLink (item) { const cm = this.simplemde.codemirror - const output = '' const selectedText = cm.getSelection() const text = selectedText || item.label + const output = `[${text}](${item.link})` - output = `[${text}](${item.link})` cm.replaceSelection(output) + + setTimeout(() => { + cm.focus() + cm.setCursor(cm.getCursor(false)) + }, 100) }, + customShortcuts () { const codemirror = this.simplemde.codemirror const keys = codemirror.getOption('extraKeys') @@ -132,13 +143,23 @@ export default { } codemirror.setOption('extraKeys', keys) }, + openCustomLinks () { this.showCustomLinks = true + }, + + setFocus () { + const codemirror = this.simplemde.codemirror + + codemirror.focus() + codemirror.setCursor(codemirror.lineCount(), 0) } }, + unmounted () { this.simplemde = null }, + watch: { modelValue (val) { if (val === this.simplemde.value()) return diff --git a/app/javascript/vue/components/markdown/buttonLinks.js b/app/javascript/vue/components/markdown/buttonLinks.js index 2808f44127..451adaead5 100644 --- a/app/javascript/vue/components/markdown/buttonLinks.js +++ b/app/javascript/vue/components/markdown/buttonLinks.js @@ -1,23 +1,28 @@ -export default () => [ - { - label: 'OTU', - model: 'otus', - link: '/tasks/otus/browse', - param: 'otu_id', - propertyLabel: 'object_label' - }, +export default [ { label: 'Source', model: 'sources', - link: '/tasks/sources/new_source', - param: 'source_id', - propertyLabel: 'cached' + labelProperty: 'cached', + labelFunction: source => { + if (source.year && source.cached_author_string) { + return [source.cached_author_string, source.year].join(', ') + } + + if (source.cached_author_string) { + return source.cached_author_string + } + + return source.cached + } + }, + { + label: 'OTU', + model: 'otus', + labelProperty: 'object_label' }, { label: 'Taxon name', model: 'taxon_names', - link: '/tasks/nomenclature/browse', - param: 'taxon_name_id', - propertyLabel: 'object_label' + labelProperty: 'object_label' } ] diff --git a/app/javascript/vue/components/markdown/customLinks.vue b/app/javascript/vue/components/markdown/customLinks.vue index e2ff3071ca..999a6a3cf0 100644 --- a/app/javascript/vue/components/markdown/customLinks.vue +++ b/app/javascript/vue/components/markdown/customLinks.vue @@ -1,11 +1,15 @@