Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 29, 2024
1 parent ceedbf7 commit 9d9bd12
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/Tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Tray {
this.isSplit = false;
this.isFolded = true;
this.isChecked = isChecked;
this.borderColor = color || "#f5f5f5";
this.borderColor = color ;
this.created_dt = created_dt || new Date();
this.element = this.createElement();
this.flexDirection = 'column';
Expand Down Expand Up @@ -125,7 +125,7 @@ class Tray {
const createdTime = document.createElement('span');
createdTime.classList.add('tray-created-time');
createdTime.textContent = this.formatCreatedTime();
createdTime.style.fontSize = '0.8em';
createdTime.style.fontSize = '0.5em';
createdTime.style.color = '#888';
// createdTime.style.marginLeft = '10px';
const checkbox = document.createElement('input');
Expand Down Expand Up @@ -598,9 +598,13 @@ formatCreatedTime() {
foldButtonRight.textContent = '▼';
foldButtonRight.style.display = "none";
} else {
// if (!this.borderColor){
// this.updateBorderColor(getRandomColor())
// }
if (!this.borderColor){
if (!this.tempColor){
this.tempColor = getRandomColor();
}
this.borderColor = this.tempColor;
this.updateBorderColor(this.tempColor)
}
content.style.display = 'block';
foldButton.textContent = '▼';
foldButton.style.display = "none";
Expand Down Expand Up @@ -913,6 +917,17 @@ formatCreatedTime() {
if (existingMenu) {
existingMenu.remove();
}

let showColor;
if (this.borderColor){
showColor = this.borderColor}
else if (this.tempColor) {
showColor = this.tempColor
}
else{
showColor = getWhiteColor();
}

const menu = document.createElement('div');
menu.classList.add('context-menu');
menu.setAttribute('tabindex', '-1');
Expand All @@ -933,8 +948,7 @@ formatCreatedTime() {
<div class="menu-item" data-action="outputMarkdown" tabindex="0">Output as Markdown</div>
<div class="menu-item" data-action="addTemplateTray" tabindex="0">Add Template Tray</div>
<div class="menu-item" tabindex="0">
<label for="borderColorPicker">Change Border Color:</label>
<input type="color" id="borderColorPicker" value="${this.borderColor}">
<input type="color" id="borderColorPicker" value="${showColor}">
</div>
`;

Expand Down

0 comments on commit 9d9bd12

Please sign in to comment.