
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
grapesjs-tailwind-typeahead
Advanced tools
Edit your pages using Tailwind CSS classes. Typeahead is included to assist with finding the correct syntax. Validate your choice by using the enter key or choose directly from the suggestions using the cursor keys.
Theme settings and Tailwind CSS directives can be modified from the toolbar and are stored in the GrapesJS configuration
Fonts can be imported using the TW directives and declared for use in the Theme configuration
For working with different screen size, change to the device and start the typeahead suggestions with the modifier ( e.g sm:text-fuchsia-400 )
This plugin will generation most selectors (6000+) but not the base, component and utilities directives classes yet
Find a live demo here GrapesJS Tailwind CSS Typeahead Demo
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet">
<link href="https://unpkg.com/grapesjs-tailwind-typeahead/dist/grapesjs-tailwind-typeahead.css" rel="stylesheet">
<script src="https://unpkg.com/grapesjs"></script>
<script src="https://unpkg.com/grapesjs-tailwind-typeahead"></script>
<div id="gjs"></div>
// sample theme configuration
const config = {
content: [],
theme: {
extend: {
colors: {
greyjoy: "#9FBEAF",
pacific: "#00ADC6",
dune: "#FCD385",
apache: "#BC9D45",
"viridian-green": "#668980",
azalea: "#E196AA",
logan: "#9190AC",
acid: "#F0FF93",
"aqua-green": "#9FD9B4",
"coton-candy": "#FAD6DE",
igloo: "#B5D0EE",
},
width: {
fhd: "1920px",
},
height: {
fhd: "1080px",
},
}
}
}
const directives =
`@tailwind base;
@tailwind components;
@tailwind utilities;`
const escapeName = (name) => `${name}`.trim().replace(/([^a-z0-9\[\]\w-:/]+)/gi, '-')
const editor = grapesjs.init({
height: '100%',
container: '#gjs',
showOffsets: true,
fromElement: true,
noticeOnUnload: false,
storageManager: false,
deviceManager: { // standard Tailwind CSS breakpoint
default: '',
devices: [
{
id: 'desktop',
name: 'desktop',
width: '',
},
{
id: 'sm',
name: 'sm: 640px',
width: '640px',
widthMedia: '640px',
maxWidth: '768px',
},
{
id: 'md',
name: 'md: 768px',
width: '768px',
widthMedia: '768px',
},
{
id: 'lg',
name: 'lg: 1024px',
width: '1024px',
widthMedia: '1024px',
},
{
id: 'xl',
name: 'xl: 1280px',
width: '1280px',
widthMedia: '1280px',
},
{
id: '2xl',
name: '2xl: 1536px',
width: '1536px',
widthMedia: '1536px',
},
],
},
styleManager: {
custom: true,
},
selectorManager: {
escapeName, // suports custom (bracketed) Tailwind instructions
componentFirst: true, // allow a per component modification of classes
},
plugins: ['grapesjs-tailwind-typeahead'],
pluginsOpts: {
'grapesjs-tailwind-typeahead': { /* options */ }
}
});
body, html {
margin: 0;
height: 100%;
}
grapesjs-tailwind-typeahead
Option | Description | Default |
---|---|---|
twCssPlayCdn | Tailwind CSS Play CDN | https://cdn.tailwindcss.com" |
twCssTheme | Tailwind CSS configuration | {} |
twCssDirectives | Tailwind CSS directives | @tailwind base; @tailwind components; @tailwind utilities; |
twCssRemoveWrapper | Remove the wrapper (usually body) from html output | true |
twCssRemoveId | Remove element id from html output | true |
twCssDark | Prepend Tailwind CSS classes with 'dark:' | true |
twCssLimit | Number of suggestions to show | 12 |
codeMirrorTheme | Code Editor theme | hopscotch |
When setting twCssRemoveId
to true, the HTML Output will be stripped of the IDs, except for those beginning with the GrapesJS Prefix.
All inline styles will be removed.
https://unpkg.com/grapesjs-tailwind-typeahead
npm i grapesjs-tailwind-typeahead
git clone https://github.com/touchflows/grapesjs-tailwind-typeahead.git
Directly in the browser
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-tailwind-typeahead.min.js"></script>
<div id="gjs"></div>
<script type="text/javascript">
var editor = grapesjs.init({
container: '#gjs',
// ...
plugins: ['grapesjs-tailwind-typeahead'],
pluginsOpts: {
'grapesjs-tailwind-typeahead': { /* options */ }
}
});
</script>
Modern javascript
import grapesjs from 'grapesjs';
import plugin from 'grapesjs-tailwind-typeahead';
import 'grapesjs/dist/css/grapes.min.css';
import 'grapesjs-tailwind-typeahead/dist/grapesjs-tailwind-typeahead.min.css';
const editor = grapesjs.init({
container : '#gjs',
// ...
plugins: [plugin],
pluginsOpts: {
[plugin]: { /* options */ }
}
// or
plugins: [
editor => plugin(editor, { /* options */ }),
],
});
Clone the repository
$ git clone https://github.com/TouchFlows/grapesjs-tailwind-typeahead.git
$ cd grapesjs-tailwind-typeahead
Install dependencies
$ npm i
Start the dev server
$ npm run dev
Build the source
$ npm run build
MIT
FAQs
Grapesjs Tailwind Typeahead Plugin
The npm package grapesjs-tailwind-typeahead receives a total of 82 weekly downloads. As such, grapesjs-tailwind-typeahead popularity was classified as not popular.
We found that grapesjs-tailwind-typeahead demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket investigates hidden protestware in npm packages that blocks user interaction and plays the Ukrainian anthem for Russian-language visitors.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.