v-multiline directive (nl2br)
This commit is contained in:
@@ -10,6 +10,7 @@ import vPlaceholder from './v-placeholder';
|
||||
import vResizeable from './v-resizeable';
|
||||
import vSortable from './v-sortable';
|
||||
import vEncode from './v-encode'
|
||||
import vMultiline from './v-multiline';
|
||||
|
||||
const directives = [
|
||||
{ key: 'click-outside', definition: vClickOutside },
|
||||
@@ -21,7 +22,8 @@ const directives = [
|
||||
{ key: 'placeholder', definition: vPlaceholder },
|
||||
{ key: 'resizeable', definition: vResizeable },
|
||||
{ key: 'sortable', definition: vSortable },
|
||||
{ key: 'encode', definition: vEncode }
|
||||
{ key: 'encode', definition: vEncode },
|
||||
{ key: 'multiline', definition: vMultiline }
|
||||
];
|
||||
|
||||
export default function (app: App)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
/**
|
||||
* Converts new line chars to <br>
|
||||
*/
|
||||
export default (el, binding) =>
|
||||
{
|
||||
if (binding.value !== binding.oldValue)
|
||||
{
|
||||
el.innerHTML = binding.value.split('\n').join('<br>');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user