mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-16 18:14:30 +08:00
Merge pull request #8343 from artoscinote/ma_SCI_11513
Fixes for inventory smart annotations [SCI-11513]
This commit is contained in:
commit
b3e71a0dd9
3 changed files with 19 additions and 9 deletions
|
@ -61,7 +61,7 @@ var RepositoryDatatable = (function(global) {
|
|||
if (scrollBody[0].offsetWidth > scrollBody[0].clientWidth) {
|
||||
scrollBody.css('width', `calc(100% + ${scrollBody[0].offsetWidth - scrollBody[0].clientWidth}px)`);
|
||||
}
|
||||
TABLE.colResize.restore();
|
||||
TABLE.colResize.restore() && renderSmartAnnotations();
|
||||
}
|
||||
|
||||
// Enable/disable edit button
|
||||
|
@ -500,7 +500,10 @@ var RepositoryDatatable = (function(global) {
|
|||
|
||||
function renderSmartAnnotations() {
|
||||
const scrollElement = $('.repository-table .dataTables_scrollBody')[0];
|
||||
scrollElement.classList.remove('sa-initialized');
|
||||
window.renderElementSmartAnnotations(scrollElement, '.text-value', scrollElement);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function checkSnapshottingStatus() {
|
||||
|
@ -889,8 +892,6 @@ var RepositoryDatatable = (function(global) {
|
|||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(restoreColumnSizes, 200);
|
||||
});
|
||||
|
||||
renderSmartAnnotations();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
:placeholder="i18n.t('repositories.item_card.repository_text_value.placeholder')"
|
||||
:unEditableRef="`textRef`"
|
||||
:smartAnnotation="true"
|
||||
:sa_value="colVal?.view"
|
||||
:expandable="expandable"
|
||||
:collapsed="collapsed"
|
||||
@toggleExpandableState="toggleExpandableState"
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
'text-sn-dark-grey': value, 'text-sn-grey': !value
|
||||
}"
|
||||
@click="enableEdit">
|
||||
<span v-if="smartAnnotation"
|
||||
v-html="sa_value || noContentPlaceholder"
|
||||
class="[&>p]:mb-0"></span>
|
||||
<span v-else>{{ value || noContentPlaceholder }}</span>
|
||||
<span>{{ value || noContentPlaceholder }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -49,7 +46,6 @@ export default {
|
|||
isNumber: { type: Boolean, default: false },
|
||||
unEditableRef: { type: String, required: true },
|
||||
smartAnnotation: { type: Boolean, default: false },
|
||||
sa_value: { type: String },
|
||||
className: { type: String, default: false }
|
||||
},
|
||||
mounted() {
|
||||
|
@ -57,6 +53,7 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
this.toggleExpandableState();
|
||||
});
|
||||
this.renderSmartAnnotations();
|
||||
},
|
||||
beforeUpdate() {
|
||||
if (!this.$refs.textareaRef) return;
|
||||
|
@ -105,6 +102,7 @@ export default {
|
|||
this.editing = false;
|
||||
this.toggleExpandableState();
|
||||
this.$emit('update', this.value);
|
||||
this.renderSmartAnnotations();
|
||||
},
|
||||
toggleExpandableState() {
|
||||
this.$nextTick(() => {
|
||||
|
@ -118,6 +116,7 @@ export default {
|
|||
},
|
||||
enableEdit(e) {
|
||||
if (e && $(e.target).hasClass('atwho-user-popover')) return;
|
||||
if (e && $(e.target).hasClass('sa-name')) return;
|
||||
if (e && $(e.target).hasClass('sa-link')) return;
|
||||
if (e && $(e.target).parent().hasClass('atwho-inserted')) return;
|
||||
|
||||
|
@ -151,6 +150,17 @@ export default {
|
|||
value = value.replace(regexp, '');
|
||||
value = value.match(decimalsRegex)[0];
|
||||
this.value = value;
|
||||
},
|
||||
renderSmartAnnotations() {
|
||||
if (!this.smartAnnotation) return;
|
||||
|
||||
this.$nextTick(() => {
|
||||
window.renderElementSmartAnnotations(
|
||||
this.$refs[this.unEditableRef],
|
||||
'span',
|
||||
document.querySelector('#repositoryItemSidebar #body-wrapper')
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue