0.0.9 • Published 6 months ago

editable-div v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

editable-div

Create an editable div element, supports vue components

About

When I need the content of the input box to perform certain actions such as highlighting, I usually use the input, textarea elements. But we can't easily get the selected text from these elements and manipulate it. So we can use the contenteditable attribute, if you have tried it then I am sure you should encounter a lot of input problems. So to solve these difficulties I have implemented it! It's not that hard, but it's convenient

instalation

Both vue2 and vue3 support

# or
pnpm add editable-div
# or
npm install editable-div
# or
yarn add editable-div

Usage

Local Registra

<script setup>
import { ref } from "vue";
import EditableDiv from "editable-div";
const content = ref("");
</script>

<template>
    <EditableDiv class="container" :content="content" :limit="10"></EditableDiv>
</template>
<style>
.container {
  background: #fff;
  height: 100px;
  width: 200px;
}
</style>

Global Registration

import { createApp } from 'vue'
import EditableDiv from "editable-div"  

createApp()
  .use(EditableDiv)
  .mount('#app')

Examples

more example information, please check the playground

Props

NameDescriptionTypeDefault
canEditallow edit the elementBooleantrue
limitallow limit max char numberNumber999999
content(*)the element content (v-model)String(required)
renderHtmlrender html into the elementBooleanfalse
rowset the element row number (eg: like textarea row attributes)Number1
typeset the element type: input or textarea (eg: default)Stringinput
autogrowwhen set the element as textarea, it will decide autogrow container box heightBooleanfalse
wrapperClassinject classString""

tips: Attributes marked with * must be passed

License

MIT License © 2021-PRESENT tzyito

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

5 years ago