tinyColorPicker icon indicating copy to clipboard operation
tinyColorPicker copied to clipboard

Embedded custom CSS gets overridden by the script-generated CSS

Open onet4 opened this issue 9 years ago • 1 comments

It seems embedded CSS inserted in the head tag gets overridden by the script's default style.

<head>
    <style>
        .cp-color-picker {
            border: 1px solid #999;
            padding: 8px;
            box-shadow: 5px 5px 16px rgba(0,0,0,0.4);
            background: #eee;
            overflow: visible;
            border-radius: 3px;
            margin: 5px 0 0;
        }
     ...
    </style>
</head>

Linked CSS is fine on the other hand.

<head>
    <link id="colorPickerMod" rel="stylesheet" type="text/css" href="mod.css">
</head>

To fix it, a workaround I found is to insert the following code to the buildCallback callback.

     $( '#tinyColorPickerStyles' ).detach().prependTo( $( 'head' ) );

This can be easily fixed in the core by changing the following line,

        $('head').append('<style type="text/css" id="tinyColorPickerStyles">' +

to

        $('head').prepend('<style type="text/css" id="tinyColorPickerStyles">' +

onet4 avatar Jun 11 '16 16:06 onet4

Hi @onet4 , I added a new option where you can decide where to add the css to not overwrite it: cssPrepend: not set or false is like before, set to true makes the CSS prepend to the

.

Cheers and thanks...

PitPik avatar Aug 30 '16 13:08 PitPik