Comments (6)
I am also not a fan of "altering" existing dom elements.
For a quick solution, I have rewritten the wrapFields function:
(sure this is not the real solution, but it worked for me and I am willing to contribute a final solution)
`function wrapFields(selector) {
document.querySelectorAll(selector).forEach(function (field) {
var parentNode = field.parentNode;
if (!parentNode.classList.contains('clr-field')) {
var wrapper = field,
classes = 'clr-field';
wrapper.insertAdjacentHTML('beforebegin', "<button type=\"button\" aria-labelledby=\"clr-open-label\"></button>");
parentNode.classList.add(classes);
parentNode.style.color = field.value;
//var wrapper = document.createElement('div');
//var classes = 'clr-field';
//if (settings.rtl || field.classList.contains('clr-rtl')) {
// classes += ' clr-rtl';
//}
//wrapper.innerHTML = "<button type=\"button\" aria-labelledby=\"clr-open-label\"></button>";
//parentNode.insertBefore(wrapper, field);
//wrapper.setAttribute('class', classes);
//wrapper.style.color = field.value;
//wrapper.appendChild(field);
}
});
}`
This is how the generated code looks like after:
I am working with bootstrap and floating label and this the result
from coloris.
@leonardfischer @MattOpen If you don't want to have your fields wrapped, you need to use a custom CSS class to initialize the color fields instead of the default [data-coloris]
selector. As the doc states, the wrap
option is ineffective on the default selector.
For my own uses, I need the color picker to keep this behavior, so I won't be accepting alterations to it.
from coloris.
Dear @mdbassit ,
I really love your work and you did a great job so far.
I have tried the solution with wrap: "false" and el: "#myid"
The color picker is rendered but the additional button showing the color is not rendered.
"For my own uses, I need the color picker to keep this behavior, so I won't be accepting alterations to it." thats also not my intention. I would like to enhance it, that you can use it with the additional div wrapped and others can use it without the additional div wrapped, but also showing the color in input.
it is unnecessary to fork the repo, only for this little enhancement. What do you think?
from coloris.
Thank you for your kind words !
I made this color picker mainly for my own use and decided to share it, modifying it to make it less convenient for me is not very reasonable. I'm afraid I have to insist on leaving it as is.
from coloris.
Hey @mdbassit that's fine by me - I already use the workaround :)
from coloris.
Dear @mdbassit ,
ok fine. I have forked your repo and made my necessary changes.
ColorisColorpicker
from coloris.
Related Issues (20)
- Add 'Cancel' button (or any custom button) HOT 5
- Materializecss compatibility HOT 2
- Popup Input Issue HOT 3
- Mouse does not lineup on palette after scrolling in scrollable container HOT 3
- Include SCSS file with variables HOT 10
- Add support for CSS custom properties (variables) HOT 1
- I would like to contribute sass/scss to the repository HOT 4
- ARIA: issue with Inline `#clr-color-marker` HOT 6
- Incorrect output value of alpha channel in 8-digit Hex Code HOT 8
- The color picker doesn't stick to the input it scrolls along HOT 2
- Option to not style the input element HOT 8
- Make `el` and `parent` options accept `Node` HOT 12
- colorArea doesn't handle right mouse button HOT 2
- Feature Request: Add Eyedropper HOT 2
- Missing info in docs about setting up thumbnails HOT 4
- Not showing in absolute positioned div HOT 2
- Alpha channel loses information HOT 5
- colorArea issue with CSS zoom HOT 1
- Coloris does not call the onChange event if the mouse is released outside the colorArea HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coloris.