-
trumbowyg color picker bugDEV/other things 2024. 9. 4. 15:17
Problem with color selection.
trumbowyg.color.js
// Original code function colorTagHandler(element, trumbowyg) { var tags = []; if (!element.style) { return tags; } // background color if (element.style.backgroundColor !== '') { var backColor = colorToHex(element.style.backgroundColor); if (trumbowyg.o.plugins.colors.colorList.indexOf(backColor) >= 0) { tags.push('backColor' + backColor); } else { tags.push('backColorFree'); } } // text color var foreColor; if (element.style.color !== '') { foreColor = colorToHex(element.style.color); } else if (element.hasAttribute('color')) { foreColor = colorToHex(element.getAttribute('color')); } if (foreColor) { if (trumbowyg.o.plugins.colors.colorList.indexOf(foreColor) >= 0) { tags.push('foreColor' + foreColor); } else { tags.push('foreColorFree'); } } return tags; } // fixed code function colorTagHandler(element, trumbowyg) { var tags = []; trumbowyg.o.plugins.colors.colorList = []; if (!element.style) { return tags; } // background color if (element.style.backgroundColor !== '') { var backColor = colorToHex(element.style.backgroundColor); if (trumbowyg.o.plugins.colors.colorList.indexOf(backColor) >= 0) { tags.push('backColor' + backColor); } else { tags.push('backColorFree'); } } // text color var foreColor; if (element.style.color !== '') { foreColor = colorToHex(element.style.color); } else if (element.hasAttribute('color')) { foreColor = colorToHex(element.getAttribute('color')); } if (foreColor) { if (trumbowyg.o.plugins.colors.colorList.indexOf(foreColor) >= 0) { tags.push('foreColor' + foreColor); } else { tags.push('foreColorFree'); } } return tags; }
'DEV > other things' 카테고리의 다른 글
linux (리눅스, 우분투 등...) 포트 오픈하기 (0) 2024.10.15 yarn 설치하기 (1) 2024.10.07 trumbowyg table bug (0) 2024.09.04 Redis/MacOs Redis 설치 (0) 2024.08.29 Redis/MacOs Redis 설치 후 "Could not connect to Redis at 127.0.0.1:6379: Connection refused" 에러 (0) 2024.08.29