채택완료

스마트에디터 왜 이러는 걸까요? ㅡㅡ;;

Copy
package main
import ("fmt")

func main() {
  var langs = [3]string{"HTML", "CSS", "JS"}
  fmt.Print(langs) // [HTML CSS JS]
}


위 코드를 적고 소스보기 해보니, 체에디터와 다르게 한줄로 보이더라구요. ㅡㅡ;;

[체에디터 경우]
<p>package main</p>
<p>import ("fmt")</p>
<p><br></p>
<p>func main() {</p>
<p>&nbsp; var langs = [3]string{"HTML", "CSS", "JS"}</p>
<p>&nbsp; fmt.Print(langs) // [HTML CSS JS]</p>
<p>}</p>

[스마트에디터 경우]
<p>package main</p><p>import ("fmt")</p><p><br></p><p>func main() {</p><p>&nbsp; var langs = [3]string{"HTML", "CSS", "JS"}</p><p>&nbsp; fmt.Print(langs) // [HTML CSS JS]</p><p>}</p>


스마트에디터도 체에디터처럼 p태그 단위로 줄바꿈해서 보이게 하려면 어떻게 해야 할까요?

답변 1개 / 댓글 2개

채택된 답변
+20 포인트

https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/config.js#L11

에 기재된 파일이

https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2Skin.html

인 경우

https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2Skin.html#L16

의 내용중 일부를 수정하며 확인할수 있도록 다음과 같이 수정후

smarteditor2.min.js > smarteditor2.js

Copy
...

<!-- <script type="text/javascript" src="./js/smarteditor2.min.js" charset="utf-8"></script> -->

<script type="text/javascript" src="./js/smarteditor2.js" charset="utf-8"></script>

...

https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/js/smarteditor2.js#L5960

의 내용을 다음과 같이 업데이트 하는 방법이 있습니다.

Copy
...

    },
    
    $AFTER_CHANGE_EDITING_MODE : function(sMode, bNoFocus) {
        if (sMode == this.sMode) { this.setIR(this.getIR().replace(/<\/p>([^\n])/g, '</p>\n$1')); }
        if (sMode == this.sMode && !bNoFocus) { 

...

답변에 대한 댓글 2개

헐, 솔직히 답변 기대도 안 한 질문이였는데....자세한 답변 감사합니다.
( ^ _____ ~ )==b
방금 적용해봤는데, 줄바꿈은 안 되네요. ㅜㅜ
그래도, 리플레이스로 대체한다는 팁은 굿입니다.

답변을 작성하려면 로그인이 필요합니다.