3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-17 23:25:02 +00:00
zeppelin/dashboard/src/directives/trim-code.ts
2019-07-28 18:24:32 +03:00

11 lines
235 B
TypeScript

import Vue from "vue";
Vue.directive("trim-code", {
bind(el, binding) {
el.innerHTML = el.innerHTML
.replace(/(^\n+|\n+$)/g, "")
.split("\n")
.map(line => line.slice(binding.value))
.join("\n");
},
});