generated from VLADIMIR/template
update editor funcs
This commit is contained in:
parent
ad248e3041
commit
468256b908
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,8 +5,8 @@
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ВД Админка</title>
|
||||
<script type="module" crossorigin src="/assets/index-DzsKK4X5.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-B9xRphsa.css">
|
||||
<script type="module" crossorigin src="/assets/index-NoTmivv5.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-b0_hiwBH.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,7 @@
|
||||
package story_service
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
@ -110,7 +111,7 @@ func (s *StoryService) UpdatePlace(node *GraphNode) error {
|
||||
s.story.Places[i] = &Place{
|
||||
Code: s.story.Places[i].Code,
|
||||
Name: node.Name,
|
||||
Text: node.Text,
|
||||
Text: formatText(node.Text),
|
||||
Applications: applications,
|
||||
}
|
||||
break
|
||||
@ -181,3 +182,27 @@ func (s *StoryService) GetGraph(ctx context.Context) *Graph {
|
||||
Edges: edges,
|
||||
}
|
||||
}
|
||||
|
||||
func formatText(text string) string {
|
||||
scanner := bufio.NewScanner(strings.NewReader(text))
|
||||
|
||||
scanner.Split(bufio.ScanLines)
|
||||
|
||||
lines := []string{}
|
||||
for scanner.Scan() {
|
||||
lines = append(lines, scanner.Text())
|
||||
}
|
||||
|
||||
res := ""
|
||||
for i, line := range lines {
|
||||
l := strings.TrimSpace(line)
|
||||
if i > 0 {
|
||||
res += "\n"
|
||||
if len(l) > 0 {
|
||||
res += " "
|
||||
}
|
||||
}
|
||||
res += l
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
@ -1,34 +1 @@
|
||||
{
|
||||
"places": [
|
||||
{
|
||||
"code": "Т-1",
|
||||
"name": "Точка 1",
|
||||
"text": "Текст точки 1([Т-2])([Т-3])",
|
||||
"applications": [{ "name": "application 1" }]
|
||||
},
|
||||
{
|
||||
"code": "Т-2",
|
||||
"name": "Точка 2",
|
||||
"text": "Текст точки 2([Т-4])",
|
||||
"applications": [{ "name": "application 2" }]
|
||||
},
|
||||
{
|
||||
"code": "Т-3",
|
||||
"name": "Точка 3",
|
||||
"text": "Текст точки 3",
|
||||
"applications": [{ "name": "application 3" }]
|
||||
},
|
||||
{
|
||||
"code": "Т-4",
|
||||
"name": "Точка 4",
|
||||
"text": "Текст точки 4",
|
||||
"applications": [{ "name": "application 4" }]
|
||||
},
|
||||
{
|
||||
"code": "Т-5",
|
||||
"name": "Точка 5",
|
||||
"text": "Текст точки 5",
|
||||
"applications": [{ "name": "application 5" }]
|
||||
}
|
||||
]
|
||||
}
|
||||
{"places":[{"code":"Т-1","name":"Точка 1","text":"Текст точки([Т-2])([Т-3])","applications":[{"name":"application 1"}]},{"code":"Т-2","name":"Точка 2","text":"Текст точки 2([Т-4])","applications":[{"name":"application 2"}]},{"code":"Т-3","name":"Точка 3","text":"Текст точки 3","applications":[{"name":"application 3"}]},{"code":"Т-4","name":"Точка 4","text":"Текст точки 4","applications":[{"name":"application 4"}]},{"code":"Т-5","name":"Точка 5","text":"Текст точки 5","applications":[{"name":"application 5"}]}]}
|
||||
Loading…
x
Reference in New Issue
Block a user