mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-12 20:24:43 +08:00
19 lines
399 B
JavaScript
19 lines
399 B
JavaScript
|
/* global ActiveStorage GLOBAL_CONSTANTS Promise i18n */
|
||
|
|
||
|
export default {
|
||
|
methods: {
|
||
|
stripHtml(html) {
|
||
|
let tmp = document.createElement("DIV");
|
||
|
tmp.innerHTML = html;
|
||
|
return tmp.textContent || tmp.innerText || "";
|
||
|
},
|
||
|
truncate(text, length) {
|
||
|
if (text.length > length) {
|
||
|
return text.substring(0, length) + '...';
|
||
|
}
|
||
|
|
||
|
return text;
|
||
|
}
|
||
|
}
|
||
|
};
|