Coder Social home page Coder Social logo

hirasso / acf-autosize Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yeah8000/acf-autosize

0.0 1.0 0.0 1.17 MB

Autoresize wysiwyg and textarea fields in ACF

License: GNU Lesser General Public License v3.0

Shell 14.93% JavaScript 34.53% PHP 42.45% Handlebars 5.74% SCSS 2.36%

acf-autosize's Introduction

acf-autosize

A wordpress plugin to automatically resize and improve upon wysiwyg and textarea fields in Advanced Custom Fields

Features

  • Automatically resize wysiwyg and textarea fields in ACF groups
  • Add data-wysiwyg-slug='my-wysiwyg-field' to the body in tinymce iframes, so you can style those iframe's contents using editor-styles:
// functions.php

function yeah9346_dashboard_tinymce_editor_styles() {
	add_editor_style(get_stylesheet_directory_uri().'/path/to/css/editor-styles.css?v=123');
}
add_action('admin_init', 'yeah9346_dashboard_tinymce_editor_styles');
/* editor-styles.css */

body[data-wysiwyg-slug="my-wysiwyg-field"] {
	...
}
  • Set min-height of WYSIWYG-fields via acf-autosize/wysiwyg/min-height-filter.
// functions.php

add_filter('acf-autosize/wysiwyg/min-height', function() {
	return 200;
});
  • Disable autosizing by default width acf-autosize/enabledByDefault-filter (is enabled by default).
// functions.php

add_filter('acf-autosize/enabledByDefault', function() {
	return false;
});

Usage

  • Install and activate like any other wordpress plugin
  • [data-wysiwyg-slug] is added to every wysiwyg field!
  • The plugin is enabled by default on all textareas and wysiwyg fields. You can disable it by adding the class no-autosize to a field.
  • You can set the the default behaviour to false via the acf-autosize/enabledByDefault-filter. After that you can reenable single fields by adding the class autosize.
  • Set min-height of WYSIWYG-fields via acf-autosize/wysiwyg/min-height-filter.

mu-plugin

acf-autosize-mu.php is a single-file drop-in version of acf-autosize for usage in your theme or mu-plugins. It contains the javascript and is AUTOGENERATED!

Development

  • Install build tools: npm install
  • Run dev watcher: npm run dev
  • Distribution: npm run dist
  • Compile mu-plugin: npm run mu
  • deploy to wordpress.org: npm run deploy your-username

Versions need a bump in:

  • 2 × acf-autosize.php
  • 1 × package.json
  • 1 × readme.txt + Changelog!

… and don't forget to npm run dist

acf-autosize's People

Contributors

clausreiser avatar dependabot[bot] avatar moritzjacobs avatar hirasso avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.