<template>
  <div class="container">
    <div class="main">
      <!-- <pre><code ref="editor" class="edit-text html" contenteditable="true" @input="highlightCode">console.log('Hello, World!');</code></pre> -->
      <div class="edit-text" contenteditable="true" spellcheck="false">
        <!-- <highlightjs ref="editor" :language="language" :code="code" v-model="code" contenteditable="true" @input="highlightCode"></highlightjs> -->
        oisafkahsdkjfhasdf sdfhkjsahfdlkjas \n /n sldhfkajshfd salkdhflkasf asfasdf
      </div>
    </div>
    <div class="setting">
        <el-button @click="saveCode" v-if="isShowStrring">保存</el-button>
        <el-button @click="router.back()" v-else>返回</el-button>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import { setStepEvent } from "@/utils/setStep";
import { formatDate } from "@/utils";
import settingStore from "@/store/modules/setting";
import { useRouter } from "vue-router";
const router = useRouter()
const useSettingStore = settingStore();
const isShowStrring = Boolean(localStorage.getItem('falg')) || false

const saveCode = () => {
  useSettingStore.setValue(true, 'isRunCode');
  localStorage.setItem('isRunCode','true')
  setStepEvent(8,formatDate(new Date()))
  useSettingStore.activeStepIndex = 9

  router.push('/program')
}
</script>

<style scoped>
.container {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  margin-top: 100px;
  /* position: relative; */
}

.main {
  width: 1442px;
  height: 753px;
  background-color: pink;
  background: url("../../assets/images/idea.png") no-repeat;
  background-size: contain;
  background-position: center center;
  position: relative;
}

.edit-text {
  position: absolute;
  left: 410px;
  top: 60px;
  width: 700px;
  height: 670px;
  background-color: #1e1e1e;
  color: #fff;
  font-family: "Courier New", monospace;
  padding: 10px;
  border-radius: 5px;
  overflow: auto;
  outline: none;
  line-height: 30px;
}
.setting{
    position: absolute;
    top: 20px;
    right: 100px;
}
</style>
