Autogrow textarea
-Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
-Depends on - Autogrow - by Chrys Bader.
- -diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..75a223a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.git +.gitignore +node_modules +README.md +CHANGELOG.md +CONTRIBUTING.md +LICENSE diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..f6adc4a --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,16 @@ +# Description + +## How to reproduce + +It helps a lot if you can create a working example from this template: +https://codepen.io/pen?template=pBxBXm + +## Expected result + +## Actual result + +# Environment + +jQuery version: +Browser: +OS: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..66c8160 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1 @@ +Please make sure to target the "experimental" branch! diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..71a0efe --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +api diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6bd009c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,181 @@ +# Changelog + +## 2.0.21 + +* Fix tooltip getting overwritten (#241) +* Update dev dependencies + +## 2.0.20 + +* Update dev dependencies + +## 2.0.19 + +* Fix warnings from jquery-migrate (#230) by Shaun Case +* Upgrade dependencies + +## 2.0.18 + +* Upgrade dependencies +* Formatting fix (remove tabs) +* Add FUNDING.yml +* Fix changelog (#218) + +## 2.0.17 + +* Upgrade jquery to 3.5.0 because of vulnerability in previous versions + +## 2.0.16 + +* Get text instead of html in callback result (#214) +* Enable shift+enter to submit form (#216) + +## 2.0.15 + +* Remove deprecated .blur() calls and replace them with .on() (#211) + +## 2.0.14 + +* Remove deprecated jQuery functions and replace them by modern counterparts (#211) + +## 2.0.13 + +* Accept list of tuples as items for select element (#208 by @emjayko) + +## 2.0.12 + +* Wrap the plugins in functions for non-conflict mode (#205) + +## 2.0.11 + +* Use text() instead of html() for revert (#203) + +## 2.0.10 + +* Regenerate the minified files + +## 2.0.9 + +* Allow resubmiting if onsubmit or submit returns false (#201 by @RobdeT) + +## 2.0.8 + +* Update dependencies to fix security vulnerabilities (CVE-2019-11358, and in js-yaml) + +## 2.0.7 + +* Change isSubmitting back to false onComplete (#192) +* Width/height now correctly taken into account for masked inputs (#189) +* Pass event object to the before callback (#188) + +## 2.0.6 + +* Fix cancel when ESC is pressed (#177) by @thezoggy +* Fix "main" entry of package.json (#181) + +## 2.0.5 + +* Sorting of select items is now an option (default is not sorted). by @nathanvda (#178) + +## 2.0.3 + +* Add ability to apply css to input element (#173) + +## 2.0.2 + +* Fix a bug where selected value will get added to the select options. by @eman1986 (#166) + +## 2.0.1 + +* Fix width setting to number, url and email (#163) + +## 2.0.0 + +* BREAKING: remove ajaxupload and old datepicker plugins (new datepicker added) +* BREAKING: change the autogrow plugin for another one +* Add datepicker plugin for jQuery-UI's datepicker +* Add form param to onblur apply (#37) +* Allow onblur function to cancel form if it returns false (#14) +* Properly cleanup after destroy. by @Scottmitch (#125) +* Return submitdata if it's a function. by @mkdgs (#109) +* Add onedit example + doc. by @chriskeeble (#122) +* Stop event propagation for charcounter. by @twashing (#86) +* Add multiselect support. by @nicholasryan (#75) +* Add html5 text attributes, email, number and url types. by @nfreear (#87) +* Add maxlength to textarea too. by @estebistec (#68) +* Add option to style buttons and add id to form. by @quocvu (#71) +* Add intercept option useful for preprocessing data. by @randell (#66) +* Pass the source event to the onedit hook. by @gfouquet (#104) +* Return element to target function (#67) +* Add 'before' option. by @bp323 (#113) +* Fix issue with html encodable characters (#110) +* Add checkbox type. by @oneslash and @pushpinderbagga (#52) +* Correctly check if checkbox is checked +* Select options are now sorted by value. by @jjwdesign (#97) +* Add submitdata to callback. by @mikemeier (#64) +* Adjust the width of the element to account for border/margin/padding +* Fix loadtext not showing (#15) +* Pass a response callback function to custom target function. by bshelton229. (#65) +* Add showfn for jquery animations before displaying form (#46) +* Remove extra loop. by @dgm (#45) +* Better demo page showing more example +* Add proper API documentation +* Add usage documentation in README.md +* Add Dockerfile to serve the demos +* Add LICENSE file + +## 1.8.0 + +* A lot of cleanup in the repo after years of abandon +* The demos folder now contains a page (index.html) with all the demo code +* Removed Textile stuff +* Removed SQLite from the demo +* Add support for configuring size and maxlength. by @bonkowski (#32) +* Set "cache" to false on loadurl. Fix issue with IE8. by @spikex (#33) +* Add package.json for npm hosting +* Remove eval to allow compilation with Closure & Fix for newer jQuery. by @flavour (#158) +* Fix issue with width/height (#137) +* Fix issue with selected in select element (#106) +* Add label settings. by @tomasm- (#40) + +## 1.7.3 + +* Add support for "jQuery plugin repository": http://plugins.jquery.com/ + +## 1.7.2 + +* Submit on change if input type select and no submit button defined ("gregpyp":http://github.com/gregpyp) + +## 1.7.1 + +* Namespace default event as click.editable ("Zangetsu":http://github.com/Zangetsu) +* Trim whitespace when determining the selected value of pulldown ("binarylogic":http://github.com/binarylogic) +* Make default settings publicly available ("lawrencepit":http://github.com/lawrencepit) +* Allow ajax calls other than 'html', e.g. json and script calls. ("lawrencepit":http://github.com/lawrencepit) +* Do not follow links if they are editable ("Darwin":http://github.com/darwin) +* make JSLInt happy ("olleolleolle":http://github.com/olleolleolle) + +## 1.7.0 + +* Full control over jQuery AJAX options for those who want to tinker. +* Fix problem with IE and placeholder with HTML tags. +* Add $.editable('disable'), $.editable('enable') and $.editable('destroy') +* Add onedit, onsubmit, onreset and onerror hooks. +* Allow passing select options as JavaScript object. +* Fix IE throwing error with textareas when width or height was set to 'none'. + +## 1.6.2 + +* Fix problems when xhtml is served application/xhtml+xml. + +## 1.6.1 + +* Submit method can now be POST (default) or PUT. +* Fix form being submitted twice in some cases. + +## 1.6.0 + +* Onblur parameter can now be a function. +* Support for any arbitrary event for triggering Jeditable +* Submitting of form will be canceled if submit() method of custom input returns false. +* Custom inputs now have access to reset() method. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b392950 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,15 @@ +# Notes to contributors + +* Target the 'experimental' branch +* Use 4 spaces for indent +* Use UNIX-style line ending +* Use UTF-8 without BOM +* Use a javascript linter +* Use single quotes for strings + +# Generate the API doc + +~~~bash +npm -g install documentation +documentation build src -f html -o api +~~~ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7d5a0ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# serve the demo page of jquery-jeditable +# https://github.com/NicolasCARPi/jquery_jeditable + +# use apache + php +FROM php:8.0-apache + +# select version or branch here +ENV JEDITABLE_VERSION master + +LABEL org.label-schema.name="jquery-jeditable demo" \ + org.label-schema.description="Run Apache and php to serve jquery-jeditable demo page" \ + org.label-schema.url="https://jeditable.elabftw.net" \ + org.label-schema.vcs-url="https://github.com/NicolasCARPi/jquery_jeditable" \ + org.label-schema.version=$JEDITABLE_VERSION\ + org.label-schema.maintainer="nicolas.carpi@curie.fr" \ + org.label-schema.schema-version="1.0" + +# install npm +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get -y --no-install-recommends install gnupg \ + && curl -sL https://deb.nodesource.com/setup_14.x | bash - \ + && apt-get install -y nodejs \ + && npm install -g documentation \ + && rm -rf /var/lib/apt/lists/* \ + && a2enmod headers + +COPY . /var/www/html +RUN ln -s /var/www/html/src /var/www/html/demos/src +COPY ./apache/000-default.conf /etc/apache2/sites-enabled/000-default.conf +COPY ./apache/php.ini /usr/local/etc/php/php.ini + +# generate api doc +WORKDIR /var/www/html +RUN documentation build src -f html -o demos/api +EXPOSE 80 diff --git a/FUNDING.yml b/FUNDING.yml new file mode 100644 index 0000000..7c1a358 --- /dev/null +++ b/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms +liberapay: NicolasCARPi +github: NicolasCARPi diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..e739f7b --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,32 @@ +/** + * Gruntfile.js + * + * Run 'grunt' in shell to minify javascript + * + */ +module.exports = function(grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + uglify: { + options: { + banner: '/*! <%= pkg.name %> <%= pkg.homepage %> */\n', + mangle: false + }, + dist: { + files: { + 'dist/jquery.jeditable.min.js': 'src/jquery.jeditable.js', + 'dist/jquery.jeditable.autogrow.min.js': 'src/jquery.jeditable.autogrow.js', + 'dist/jquery.jeditable.charcounter.min.js': 'src/jquery.jeditable.charcounter.js', + 'dist/jquery.jeditable.datepicker.min.js': 'src/jquery.jeditable.datepicker.js', + 'dist/jquery.jeditable.masked.min.js': 'src/jquery.jeditable.masked.js', + 'dist/jquery.jeditable.time.min.js': 'src/jquery.jeditable.time.js', + } + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-uglify-es'); + grunt.registerTask('default', 'uglify'); + +}; diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..86111c6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2006 Mika Tuupola, Dylan Verheul, Nicolas CARPi + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile deleted file mode 100644 index eca7f22..0000000 --- a/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -VERSION = 1.7.1 -SHELL = /bin/sh -DOWNLOAD = /var/www/www.appelsiini.net/htdocs/download -JSPACKER = /home/tuupola/bin/jspacker -JSMIN = /home/tuupola/bin/jsmin - -#all: jeditable packed minified latest wysiwyg -all: jeditable minified latest wysiwyg - -jeditable: jquery.jeditable.js - cp jquery.jeditable.js $(DOWNLOAD)/jquery.jeditable-$(VERSION).js - -packed: jquery.jeditable.js - $(JSPACKER) < jquery.jeditable.js > jquery.jeditable.pack.js - cp jquery.jeditable.pack.js $(DOWNLOAD)/jquery.jeditable-$(VERSION).pack.js - -minified: jquery.jeditable.js - $(JSMIN) < jquery.jeditable.js > jquery.jeditable.mini.js - cp jquery.jeditable.mini.js $(DOWNLOAD)/jquery.jeditable-$(VERSION).mini.js - -latest: jquery.jeditable.js jquery.jeditable.pack.js - cp jquery.jeditable.js $(DOWNLOAD)/jquery.jeditable.js - cp jquery.jeditable.ajaxupload.js $(DOWNLOAD)/jquery.jeditable.ajaxupload.js - cp jquery.jeditable.autogrow.js $(DOWNLOAD)/jquery.jeditable.autogrow.js -# cp jquery.jeditable.datepicker.js $(DOWNLOAD)/jquery.jeditable.datepicker.js - cp jquery.jeditable.masked.js $(DOWNLOAD)/jquery.jeditable.masked.js -# cp jquery.jeditable.tageditor.js $(DOWNLOAD)/jquery.jeditable.tageditor.js - cp jquery.jeditable.time.js $(DOWNLOAD)/jquery.jeditable.time.js - cp jquery.jeditable.timepicker.js $(DOWNLOAD)/jquery.jeditable.timepicker.js - cp jquery.jeditable.charcounter.js $(DOWNLOAD)/jquery.jeditable.charcounter.js -# cp jquery.jeditable.pack.js $(DOWNLOAD)/jquery.jeditable.pack.js - cp jquery.jeditable.mini.js $(DOWNLOAD)/jquery.jeditable.mini.js - - -.PHONY: wysiwyg -wysiwyg: - cp wysiwyg/jquery.jeditable.wysiwyg.js $(DOWNLOAD)/jquery.jeditable.wysiwyg.js - -tests: jquery.jeditable.js - rm examples/lib/jquery.jeditable.js - cp jquery.jeditable.js examples/lib/ - -tarball: examples/index.html - rm examples/lib/jquery.jeditable.js - cp jquery.jeditable.js examples/lib/ - /usr/local/bin/tar -X ignore.txt -czvf jEditable_examples-$(VERSION).tar.gz examples/* - cp jEditable_examples-$(VERSION).tar.gz $(DOWNLOAD) diff --git a/README.md b/README.md new file mode 100644 index 0000000..fb7279d --- /dev/null +++ b/README.md @@ -0,0 +1,251 @@ +# jquery-jeditable + +[](https://www.npmjs.com/package/jquery-jeditable) +[](https://www.codacy.com/app/elabftw/jquery_jeditable) +[](https://github.com/NicolasCARPi/jquery_jeditable/blob/master/LICENSE) + +# DEPRECATION NOTICE + +**This project is deprecated** and should not be used in a fresh project. Have a look at [Malle](https://github.com/deltablot/malle/) library instead. It is more or less the same, but in typescript and without a jQuery dependency. + +## Alternative library + +Use [Malle](https://github.com/deltablot/malle/). + + +## Description + +Edit in place plugin for [jQuery](https://jquery.com/) (compatible with jQuery v3.4.0+). + +Bind it to an element on the page, and when clicked the element will become a form that will be sent by asynchronous (ajax) POST request to an URL. + +[](https://jeditable.elabftw.net) + +Works with text inputs, textarea, select, datepicker, and more… Comes with a ton of different options you can use to do exactly what you want! + +## Live demo + +See it in action: [LIVE DEMO](https://jeditable.elabftw.net/) + +## Installation + +~~~bash +npm install jquery-jeditable +~~~ + +## Usage + +### Loading the library + +Use a ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
You might also want to check default inputs demo. - -
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
-Depends on - Autogrow - by Chrys Bader.
- -
- Fileupload which uses Ajax File Upload plugin.
- For security reasons after uploading this demo only display file size and name.
-
-
-
-
Depends on - Masked Input by Josh Bush. -
- -- Depends on Timepicker - by Jason Huck. -
- -- Similar as previous but without dependenices. See how to create inputs tutorial. -
- -- Using character counter. -
- -