fresh-tap
A configurable wysiwyg editor built on top of the Tip Tap Editor.
863
| Install | |
|---|---|
npm install fresh-tap |
|
| Latest Version: | 0.2.8 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Nov 9, 2023 |
| Links: | Bitbucket · npm |
Maintainer: freshinteractive
fresh-tap
Fresh Tap is a framework-agnostic Custom Element WYSIWYG Editor build on top of Tiptap and Vue.
Installation
npm i fresh-tap
Usage
HTML:
<head>
...
<!-- must make link public first -->
<link rel="stylesheet" href="/fresh-tap/dist/style.css" />
...
</head>
<body>
<div id="fresh-tap-wrapper"></div>
<script type="module">
import { FreshTap } from 'fresh-tap'
const freshTap = FreshTap({
initialValue: 'my initial value here',
previewUrl: 'https://your-preview-url.com',
previewSelector: '.selector',
previewWrapperElement: {
element: 'div',
attributes: {
class: 'wrapper-class'
}
},
keepEmptyParagraphLineBreaks: true,
editorStyles: '.FreshTapEditor .ProseMirror { display: grid; grid-template-columns: 100%; gap: 20px; }'
})
freshTap.addEventListener('value-updated', (e) => {
console.log(e.detail)
})
document.getElementById('fresh-tap-wrapper')
?.appendChild?.(freshTap)
</script>
</body>
Vue:
<template>
<div>
<div ref="wysiwyg" />
</div>
</template>
<script>
import { FreshTap } from 'fresh-tap'
import 'fresh-tap/dist/style.css'
export default {
data () {
return {
freshTap: null
}
},
mounted () {
this.freshTap = FreshTap({
initialValue: 'my initial value here',
previewUrl: 'https://your-preview-url.com',
previewSelector: '.selector',
previewWrapperElement: {
element: 'div',
attributes: {
class: 'wrapper-class'
}
},
keepEmptyParagraphLineBreaks: true,
editorStyles: '.FreshTapEditor .ProseMirror { display: grid; grid-template-columns: 100%; gap: 20px; }'
})
this.freshTap.addEventListener('value-updated', (e) => {
// do something with the updated value here...
console.log(e.detail)
})
this.$refs.wysiwyg.appendChild(this.freshTap)
}
}
</script>
Props
| Name | Description | Default | Example |
|---|---|---|---|
| initialValue | The initial value to populate the editor with. | '' |
'<p>test!</p>' |
| previewUrl | The url to populate the 'preview' content into. | '' |
'https://yoursite.com/page-where-the-content-will-live' |
| previewSelector | What section of the preview url should be replaced by the content. | '' |
'.css-selector-here' |
| previewWrapperElement | The element to wrap your content in. | null |
{ element: 'div', attributes: { class: 'your-class' } } |
| uploadImage | Your upload image function. | async (file) => await blobToDataUrl(file) |
any async function that takes an image Blob and returns the string of where the image is saved. |
| save | Your save function. | null |
any function that takes a value and saves it to your database. |
| keepEmptyParagraphLineBreaks | Boolean to keep empty paragraph line breaks. | false |
true |
| editorStyles | Styles to apply to the editor. Styles should be prefixed with the class .FreshTapEditor .ProseMirror |
'' |
'.FreshTapEditor .ProseMirror { display: grid; grid-template-columns: 100%; gap: 20px; }' |
** All props are optional.
Related Packages
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.2.8 | ^3.2.47 | MIT | |
| 0.2.7 | ^3.2.47 | MIT | |
| 0.2.6 | ^3.2.47 | MIT | |
| 0.2.5 | ^3.2.47 | MIT | |
| 0.2.4 | ^3.2.47 | MIT | |
| 0.2.3 | ^3.2.47 | MIT | |
| 0.2.2 | ^3.2.47 | MIT | |
| 0.2.1 | ^3.2.47 | MIT | |
| 0.2.0 | ^3.2.47 | MIT | |
| 0.1.9 | ^3.2.47 | MIT | |
| 0.1.7 | ^3.2.47 | MIT | |
| 0.1.6 | ^3.2.47 | MIT | |
| 0.1.5 | ^3.2.47 | MIT | |
| 0.1.4 | ^3.2.47 | MIT | |
| 0.1.3 | ^3.2.47 | MIT | |
| 0.1.2 | ^3.2.47 | MIT | |
| 0.1.1 | ^3.2.47 | MIT | |
| 0.1.0 | ^3.2.47 | MIT | |
| 0.0.9 | ^3.2.47 | MIT | |
| 0.0.8 | ^3.2.47 | MIT | |
| 0.0.7 | ^3.2.47 | MIT | |
| 0.0.6 | ^3.2.47 | MIT | |
| 0.0.5 | ^3.2.47 | MIT | |
| 0.0.4 | ^3.2.47 | MIT | |
| 0.0.3 | ^3.2.47 | MIT | |
| 0.0.2 | ^3.2.47 | MIT | |
| 0.0.1 | ^3.2.47 | MIT | |
| 0.0.0 | ^3.2.47 | MIT |