This commit is contained in:
shaoyongjun 2024-11-10 23:14:34 +08:00
parent c115dda50b
commit d8302cb9ca
3 changed files with 163 additions and 140 deletions

View File

@ -27,12 +27,40 @@ define(function (require, exports, module) {
}; };
} }
//refreshEditColor
let refreshEditColor = localStorage.getItem('refreshEditColor');
if (refreshEditColor !== undefined && refreshEditColor !== null) {
this.refreshEditColor = refreshEditColor;
} else {
this.refreshEditColor = "black";
}
let refreshEditColorLiList = document.querySelectorAll(".my_style_nav ul[data-my-style-type='refreshEditColor'] li");
for (let i = 0; i < refreshEditColorLiList.length; i++) {
let tmpLi=refreshEditColorLiList[i];
if (tmpLi.getAttribute("data-my-style-v") === this.refreshEditColor) {
tmpLi.setAttribute("data-my-select", "true");
tmpLi.setAttribute("data-my-select-v", tmpLi.parentElement.getAttribute("data-my-select-v"));
} else {
tmpLi.removeAttribute("data-my-select");
}
}
//refreshEditBgColor //refreshEditBgColor
let refreshEditBgColor = localStorage.getItem('refreshEditBgColor'); let refreshEditBgColor = localStorage.getItem('refreshEditBgColor');
if (refreshEditBgColor !== undefined && refreshEditBgColor !== null) { if (refreshEditBgColor !== undefined && refreshEditBgColor !== null) {
this.refreshEditBgColor = refreshEditBgColor; this.refreshEditBgColor = refreshEditBgColor;
} else { } else {
this.refreshEditBgColor = null; this.refreshEditBgColor = "transparent";
}
let refreshEditBgColorLiList = document.querySelectorAll(".my_style_nav ul[data-my-style-type='refreshEditBgColor'] li");
for (let i = 0; i < refreshEditBgColorLiList.length; i++) {
let tmpLi=refreshEditBgColorLiList[i];
if (tmpLi.getAttribute("data-my-style-v") === this.refreshEditBgColor) {
tmpLi.setAttribute("data-my-select", "true");
tmpLi.setAttribute("data-my-select-v", tmpLi.parentElement.getAttribute("data-my-select-v"));
} else {
tmpLi.removeAttribute("data-my-select");
}
} }
this.usn = "syjSyj"; this.usn = "syjSyj";

View File

@ -67,8 +67,10 @@ define(function (require, exports, module) {
let tSpan = curLi.parentElement.parentElement.previousElementSibling; let tSpan = curLi.parentElement.parentElement.previousElementSibling;
console.log("refreshEditColor ", dataMySelectK, dataMySelectV, tSpan, tSpan.getAttribute("data-v")) console.log("refreshEditColor ", dataMySelectK, dataMySelectV, tSpan, tSpan.getAttribute("data-v"))
tSpan.setAttribute("data-v", dataMySelectV) tSpan.setAttribute("data-v", dataMySelectV);
//保存在本地 refreshEditColor
localStorage.setItem('refreshEditColor', dataMySelectV);
} }
function refreshEditBgColor(curLi) { function refreshEditBgColor(curLi) {
@ -81,8 +83,9 @@ define(function (require, exports, module) {
let tSpan = curLi.parentElement.parentElement.previousElementSibling; let tSpan = curLi.parentElement.parentElement.previousElementSibling;
console.log("refreshEditBgColor ", dataMySelectK, dataMySelectV, tSpan, tSpan.getAttribute("data-v")) console.log("refreshEditBgColor ", dataMySelectK, dataMySelectV, tSpan, tSpan.getAttribute("data-v"))
tSpan.setAttribute("data-v", dataMySelectV);
tSpan.setAttribute("data-v", dataMySelectV) //保存在本地 refreshEditBgColor
localStorage.setItem('refreshEditBgColor', dataMySelectV);
} }
function refreshPFontSize(curLi) { function refreshPFontSize(curLi) {

View File

@ -33,7 +33,7 @@
<body> <body>
<header> <header>
<div class="fixStylePosition" id="_style_utils"> <div class="fixStylePosition" id="_style_utils">
<div class="fixStyleOut"> <div class="fixStyleOut">
@ -167,20 +167,13 @@
</svg> </svg>
</span> </span>
<ul class="menu fllil" data-my-select-v="✔" data-my-style-type="refreshEditColor"> <ul class="menu fllil" data-my-select-v="✔" data-my-style-type="refreshEditColor">
<li data-my-select="true" data-my-select-v="✔" data-my-style-k="color"
data-my-style-v="white">
<span>无色</span>
</li>
<li data-my-style-k="color" data-my-style-v="red"><span style="color: red">红色</span></li>
<li data-my-style-k="color" data-my-style-v="#edce02"><span
style="color: #edce02">黄色</span>
</li>
<li data-my-style-k="color" data-my-style-v="blue"><span
style="color: blue">蓝色</span></li>
<li data-my-style-k="color" data-my-style-v="black"><span style="color: black">黑色</span> <li data-my-style-k="color" data-my-style-v="black"><span style="color: black">黑色</span>
</li> </li>
<li data-my-style-k="color" data-my-style-v="gray"><span <li data-my-style-k="color" data-my-style-v="red"><span style="color: red">红色</span></li>
style="color: gray">灰色</span></li> <li data-my-style-k="color" data-my-style-v="#edce02"><span style="color: #edce02">黄色</span>
</li>
<li data-my-style-k="color" data-my-style-v="blue"><span style="color: blue">蓝色</span></li>
<li data-my-style-k="color" data-my-style-v="gray"><span style="color: gray">灰色</span></li>
</ul> </ul>
</span> </span>
</div> </div>
@ -223,8 +216,7 @@
</svg> </svg>
</span> </span>
<ul class="menu fllil" data-my-select-v="✔" data-my-style-type="refreshEditBgColor"> <ul class="menu fllil" data-my-select-v="✔" data-my-style-type="refreshEditBgColor">
<li data-my-select="true" data-my-select-v="✔" data-my-style-k="background-color" <li data-my-style-k="background-color" data-my-style-v="transparent">
data-my-style-v="transparent">
<span>空白</span> <span>空白</span>
</li> </li>
<li data-my-style-k="background-color" data-my-style-v="lightcoral"><span <li data-my-style-k="background-color" data-my-style-v="lightcoral"><span
@ -239,7 +231,7 @@
</div> </div>
<div class="my-divider-item"></div> <div class="my-divider-item"></div>
<div style="display: flex;margin: 0 0; "> <div style="display: flex;margin: 0 0;line-height: 1; ">
<span> <span>
<span id="cur_my_font_size" style="font-size: 14px">14px</span> <span id="cur_my_font_size" style="font-size: 14px">14px</span>
</span> </span>
@ -290,21 +282,21 @@
</div> </div>
</header> </header>
<main id="myEdit_main" style="font-size: 14px"> <main id="myEdit_main" style="font-size: 14px">
<!-- 标题 --> <!-- 标题 -->
<h3 id="my-title" contenteditable="true"></h3> <h3 id="my-title" contenteditable="true"></h3>
<!-- 内容 --> <!-- 内容 -->
<div id="yxl_note" contenteditable="true" spellcheck="false" translate="no"> <div id="yxl_note" contenteditable="true" spellcheck="false" translate="no">
</div> </div>
</main> </main>
<footer> <footer>
</footer> </footer>
<div id="testDiv" style="font-size: 14px; width: 300px;margin-left: 10%; display: block"></div> <div id="testDiv" style="font-size: 14px; width: 300px;margin-left: 10%; display: block"></div>
<div id="testDevice" style="font-size: 14px; width: 300px;margin-left: 10%; display: block"></div> <div id="testDevice" style="font-size: 14px; width: 300px;margin-left: 10%; display: block"></div>
</body> </body>
<script> <script>