feat: 턴 조작기에 '텍스트 복사' 추가
This commit is contained in:
@@ -48,19 +48,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</DragSelect>
|
</DragSelect>
|
||||||
<BButton
|
<div
|
||||||
ref="btnCopy"
|
class="hoverPanel d-grid"
|
||||||
:style="{
|
:style="{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
display: isCopyButtonShown ? 'block' : 'none',
|
display: isCopyButtonShown ? 'grid !important' : 'none !important',
|
||||||
top: `${btnPos * 30 + 25}px`,
|
top: `${btnPos * 30 + 25}px`,
|
||||||
right: '10px',
|
right: '10px',
|
||||||
}"
|
}"
|
||||||
@blur="hideCopyButton()"
|
|
||||||
@click="tryCopy()"
|
|
||||||
>
|
>
|
||||||
복사하기
|
<BButton ref="btnCopy" variant="primary" @blur="hideCopyButton()" @click="tryCopy()"> 복사하기 </BButton>
|
||||||
</BButton>
|
<BButton ref="btnCopy" @blur="hideCopyButton()" @click="tryTextCopy()"> 텍스트 복사</BButton>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -117,7 +116,7 @@ function dragStart() {
|
|||||||
isDragToggle.value = true;
|
isDragToggle.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideCopyButton(){
|
function hideCopyButton() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isCopyButtonShown.value = false;
|
isCopyButtonShown.value = false;
|
||||||
}, 1);
|
}, 1);
|
||||||
@@ -166,6 +165,25 @@ function tryCopy() {
|
|||||||
storedActionsHelper.clipboard.value = [...actions];
|
storedActionsHelper.clipboard.value = [...actions];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeTagRegEx = /<[^>]*>?/g;
|
||||||
|
|
||||||
|
function tryTextCopy() {
|
||||||
|
const actions = queryActionHelper.extractQueryActions();
|
||||||
|
isCopyButtonShown.value = false;
|
||||||
|
|
||||||
|
const turnBriefs: [number, string][] = [];
|
||||||
|
for (const action of actions) {
|
||||||
|
const [turnIdxList, turnObj] = action;
|
||||||
|
for (const turnIdx of turnIdxList) {
|
||||||
|
turnBriefs.push([turnIdx, `${turnIdx + 1}턴 ${turnObj.brief.replace(removeTagRegEx, "")}`]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
turnBriefs.sort((a, b) => a[0] - b[0]);
|
||||||
|
|
||||||
|
const text = turnBriefs.map(([, brief]) => brief).join("\n");
|
||||||
|
void navigator.clipboard.writeText(text);
|
||||||
|
}
|
||||||
|
|
||||||
const turnTimes = ref<string[]>([]);
|
const turnTimes = ref<string[]>([]);
|
||||||
|
|
||||||
if (!props.officer || !props.officer.turnTime) {
|
if (!props.officer || !props.officer.turnTime) {
|
||||||
|
|||||||
@@ -81,6 +81,8 @@
|
|||||||
<BDropdownItem @click="clipboardCopy"> <i class="bi bi-files" /> 복사하기 </BDropdownItem>
|
<BDropdownItem @click="clipboardCopy"> <i class="bi bi-files" /> 복사하기 </BDropdownItem>
|
||||||
<BDropdownItem @click="clipboardPaste"> <i class="bi bi-clipboard-fill" /> 붙여넣기 </BDropdownItem>
|
<BDropdownItem @click="clipboardPaste"> <i class="bi bi-clipboard-fill" /> 붙여넣기 </BDropdownItem>
|
||||||
<BDropdownDivider />
|
<BDropdownDivider />
|
||||||
|
<BDropdownItem @click="clipboardTextCopy"> <i class="bi bi-files" /> 텍스트 복사 </BDropdownItem>
|
||||||
|
<BDropdownDivider />
|
||||||
<BDropdownItem @click="setStoredActions">
|
<BDropdownItem @click="setStoredActions">
|
||||||
<i class="bi bi-bookmark-plus-fill" /> 보관하기
|
<i class="bi bi-bookmark-plus-fill" /> 보관하기
|
||||||
</BDropdownItem>
|
</BDropdownItem>
|
||||||
@@ -640,6 +642,31 @@ async function clipboardPaste(releaseSelect = true) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeTagRegEx = /<[^>]*>?/g;
|
||||||
|
|
||||||
|
function clipboardTextCopy(releaseSelect = true) {
|
||||||
|
const rawActions = queryActionHelper.extractQueryActions();
|
||||||
|
if (rawActions.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const turnBriefs: [number, string][] = [];
|
||||||
|
for (const action of rawActions) {
|
||||||
|
const [turnIdxList, turnObj] = action;
|
||||||
|
for (const turnIdx of turnIdxList) {
|
||||||
|
turnBriefs.push([turnIdx, `${turnIdx + 1}턴 ${turnObj.brief.replace(removeTagRegEx, "")}`]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
turnBriefs.sort((a, b) => a[0] - b[0]);
|
||||||
|
|
||||||
|
const text = turnBriefs.map(([, brief]) => brief).join("\n");
|
||||||
|
void navigator.clipboard.writeText(text);
|
||||||
|
|
||||||
|
if (releaseSelect) {
|
||||||
|
queryActionHelper.releaseSelectedTurnList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function subRepeatCommand(releaseSelect = true): Promise<boolean> {
|
async function subRepeatCommand(releaseSelect = true): Promise<boolean> {
|
||||||
const reqTurnList = queryActionHelper.getSelectedTurnList();
|
const reqTurnList = queryActionHelper.getSelectedTurnList();
|
||||||
const selectedMinTurnIdx = reqTurnList[0];
|
const selectedMinTurnIdx = reqTurnList[0];
|
||||||
|
|||||||
@@ -225,6 +225,8 @@
|
|||||||
<i class="bi bi-clipboard-fill" /> 붙여넣기
|
<i class="bi bi-clipboard-fill" /> 붙여넣기
|
||||||
</BDropdownItem>
|
</BDropdownItem>
|
||||||
<BDropdownDivider />
|
<BDropdownDivider />
|
||||||
|
<BDropdownItem @click="clipboardTextCopy"> <i class="bi bi-files" /> 텍스트 복사 </BDropdownItem>
|
||||||
|
<BDropdownDivider />
|
||||||
<BDropdownItem @click="setStoredActions">
|
<BDropdownItem @click="setStoredActions">
|
||||||
<i class="bi bi-bookmark-plus-fill" /> 보관하기
|
<i class="bi bi-bookmark-plus-fill" /> 보관하기
|
||||||
</BDropdownItem>
|
</BDropdownItem>
|
||||||
@@ -621,6 +623,32 @@ async function clipboardPaste(releaseSelect = true) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeTagRegEx = /<[^>]*>?/g;
|
||||||
|
|
||||||
|
function clipboardTextCopy(releaseSelect = true) {
|
||||||
|
const rawActions = queryActionHelper.extractQueryActions();
|
||||||
|
if (rawActions.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const turnBriefs: [number, string][] = [];
|
||||||
|
for (const action of rawActions) {
|
||||||
|
const [turnIdxList, turnObj] = action;
|
||||||
|
for (const turnIdx of turnIdxList) {
|
||||||
|
turnBriefs.push([turnIdx, `${turnIdx + 1}턴 ${turnObj.brief.replace(removeTagRegEx, "")}`]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
turnBriefs.sort((a, b) => a[0] - b[0]);
|
||||||
|
|
||||||
|
const text = turnBriefs.map(([, brief]) => brief).join("\n");
|
||||||
|
void navigator.clipboard.writeText(text);
|
||||||
|
|
||||||
|
if (releaseSelect) {
|
||||||
|
queryActionHelper.releaseSelectedTurnList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function subRepeatCommand(releaseSelect = true): Promise<boolean> {
|
async function subRepeatCommand(releaseSelect = true): Promise<boolean> {
|
||||||
const reqTurnList = queryActionHelper.getSelectedTurnList();
|
const reqTurnList = queryActionHelper.getSelectedTurnList();
|
||||||
const selectedMinTurnIdx = reqTurnList[0];
|
const selectedMinTurnIdx = reqTurnList[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user