From 829589dfa2575887d9bd9306ebaa52111d77c4f4 Mon Sep 17 00:00:00 2001 From: Harri Heljala Date: Thu, 22 Oct 2015 16:55:17 +0300 Subject: [PATCH 1/3] Added a option for getting rid of a duplicate tag char typed by the user. --- README.md | 1 + tagging.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 1a0488b..0412cf2 100644 --- a/README.md +++ b/README.md @@ -308,6 +308,7 @@ a little description and the default value: | **pre-tags-separator** | `String` | `", "` | This is used to `split` the initial text and add `preexistint-tag`. By default, you must put new tags using a comma and a space (`", "`). | | **tag-box-class** | `String` | `"tagging"` | Class of the tag box. | | **tag-char** | `String` | `"#"` | Single Tag char. | +| **no-duplicate-tag-char** | `String` | `"#"` | True to remove a tag char typed by the user. | | **tag-class** | `String` | `"tag"` | Single Tag class. | | **tag-on-blur** | `Boolean` | `true` | If `true`, clicking away from the `$type_zone` will add a new tag. | | **tags-input-name** | `String` | `"tag"` | Name to use as `name=""` in single tags' input. By default, all tags being passed as array like `tag[]`. | diff --git a/tagging.js b/tagging.js index 5698034..4a3e8a8 100644 --- a/tagging.js +++ b/tagging.js @@ -81,6 +81,7 @@ "pre-tags-separator": ", ", // By default, you must put new tags using a new line "tag-box-class": "tagging", // Class of the tag box "tag-char": "#", // Single Tag char + "no-duplicate-tag-char": false, // True to remove a tag char typed by the user "tag-class": "tag", // Single Tag class "tags-input-name": "tag", // Name to use as name="" in single tags (by default tag[]) "tag-on-blur": true, // Add the current tag if user clicks away from type-zone @@ -131,6 +132,11 @@ text = text.toLowerCase(); } + // If tag-char already given remove it + if ( self.config[ "no-duplicate-tag-char" ] && text.charAt(0) === self.config[ "tag-char" ] ) { + text = text.substring(1); + } + // Checking if text is a Forbidden Word l = forbidden_words.length; while ( l-- ) { From adbb7a5a1fe600cb3d21ecf0b6ddcc6927d0397b Mon Sep 17 00:00:00 2001 From: Harri Heljala Date: Fri, 23 Oct 2015 13:41:50 +0300 Subject: [PATCH 2/3] Corrected option type documentation. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0412cf2..edf025c 100644 --- a/README.md +++ b/README.md @@ -308,7 +308,7 @@ a little description and the default value: | **pre-tags-separator** | `String` | `", "` | This is used to `split` the initial text and add `preexistint-tag`. By default, you must put new tags using a comma and a space (`", "`). | | **tag-box-class** | `String` | `"tagging"` | Class of the tag box. | | **tag-char** | `String` | `"#"` | Single Tag char. | -| **no-duplicate-tag-char** | `String` | `"#"` | True to remove a tag char typed by the user. | +| **no-duplicate-tag-char** | `Boolean` | `"#"` | True to remove a tag char typed by the user. | | **tag-class** | `String` | `"tag"` | Single Tag class. | | **tag-on-blur** | `Boolean` | `true` | If `true`, clicking away from the `$type_zone` will add a new tag. | | **tags-input-name** | `String` | `"tag"` | Name to use as `name=""` in single tags' input. By default, all tags being passed as array like `tag[]`. | From 8c0bb3c8f042e68625ca782ec203e5de8156e6b8 Mon Sep 17 00:00:00 2001 From: Harri Heljala Date: Fri, 23 Oct 2015 14:10:50 +0300 Subject: [PATCH 3/3] Still a small correction to the readme. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index edf025c..4a99593 100644 --- a/README.md +++ b/README.md @@ -308,7 +308,7 @@ a little description and the default value: | **pre-tags-separator** | `String` | `", "` | This is used to `split` the initial text and add `preexistint-tag`. By default, you must put new tags using a comma and a space (`", "`). | | **tag-box-class** | `String` | `"tagging"` | Class of the tag box. | | **tag-char** | `String` | `"#"` | Single Tag char. | -| **no-duplicate-tag-char** | `Boolean` | `"#"` | True to remove a tag char typed by the user. | +| **no-duplicate-tag-char** | `Boolean` | `false` | True to remove a tag char typed by the user. | | **tag-class** | `String` | `"tag"` | Single Tag class. | | **tag-on-blur** | `Boolean` | `true` | If `true`, clicking away from the `$type_zone` will add a new tag. | | **tags-input-name** | `String` | `"tag"` | Name to use as `name=""` in single tags' input. By default, all tags being passed as array like `tag[]`. |