<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.moorper.com/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.moorper.com/feed.php">
        <title>Moorper Wiki - blog:nextjs</title>
        <description>我等采石之人，当心怀建造大教堂之愿景。</description>
        <link>https://wiki.moorper.com/</link>
        <image rdf:resource="https://wiki.moorper.com/_media/wiki:dokuwiki.svg" />
       <dc:date>2026-04-08T21:08:23+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.moorper.com/blog:nextjs:using-react-ace-in-nextjs"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.moorper.com/_media/wiki:dokuwiki.svg">
        <title>Moorper Wiki</title>
        <link>https://wiki.moorper.com/</link>
        <url>https://wiki.moorper.com/_media/wiki:dokuwiki.svg</url>
    </image>
    <item rdf:about="https://wiki.moorper.com/blog:nextjs:using-react-ace-in-nextjs">
        <dc:format>text/html</dc:format>
        <dc:date>2023-06-16T07:16:46+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>在 Next.js 中使用 React-Ace</title>
        <link>https://wiki.moorper.com/blog:nextjs:using-react-ace-in-nextjs</link>
        <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;在-nextjs-中使用-react-ace&quot;&gt;在 Next.js 中使用 React-Ace&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://github.com/securingsincity/react-ace&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;https://github.com/securingsincity/react-ace&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://github.com/securingsincity/react-ace&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://9to5tutorial.com/notes-on-using-react-ace-in-next-js&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;https://9to5tutorial.com/notes-on-using-react-ace-in-next-js&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://9to5tutorial.com/notes-on-using-react-ace-in-next-js&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
安装 react-ace
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;npm &lt;span class=&quot;kw2&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;--save&lt;/span&gt; react-ace ace-builds&lt;/pre&gt;

&lt;p&gt;
定义 AceEditor 组件
&lt;/p&gt;
&lt;pre class=&quot;code javascript&quot;&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;use client&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw5&quot;&gt;import&lt;/span&gt; React from &lt;span class=&quot;st0&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw5&quot;&gt;import&lt;/span&gt; dynamic from &lt;span class=&quot;st0&quot;&gt;&amp;quot;next/dynamic&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;const&lt;/span&gt; AceEditor &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; dynamic&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
  async &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;const&lt;/span&gt; ace &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; await &lt;span class=&quot;kw5&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;react-ace&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    await &lt;span class=&quot;kw5&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;ace-builds/src-noconflict/mode-java&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    await &lt;span class=&quot;kw5&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;ace-builds/src-noconflict/theme-github&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    await &lt;span class=&quot;kw5&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;ace-builds/src-noconflict/ext-language_tools&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; ace&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; ssr&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
使用组件
&lt;/p&gt;
&lt;pre class=&quot;code javascript&quot;&gt;&lt;span class=&quot;kw5&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; Home&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; onChange&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;newValue&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; string&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    console.&lt;span class=&quot;me1&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;change&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; newValue&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
    &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;AceEditor
      mode&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;java&amp;quot;&lt;/span&gt;
      theme&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;github&amp;quot;&lt;/span&gt;
      onChange&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;onChange&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
      name&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;UNIQUE_ID_OF_DIV&amp;quot;&lt;/span&gt;
      width&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;100%&amp;quot;&lt;/span&gt;
      editorProps&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; $blockScrolling&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;sy0&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;https://wiki.moorper.com/tag:blog?do=showtag&amp;amp;tag=blog&quot; class=&quot;wikilink1&quot; title=&quot;tag:blog&quot; rel=&quot;tag&quot;&gt;blog&lt;/a&gt;,
	&lt;a href=&quot;https://wiki.moorper.com/tag:nextjs?do=showtag&amp;amp;tag=nextjs&quot; class=&quot;wikilink1&quot; title=&quot;tag:nextjs&quot; rel=&quot;tag&quot;&gt;nextjs&lt;/a&gt;,
	&lt;a href=&quot;https://wiki.moorper.com/tag:react?do=showtag&amp;amp;tag=react&quot; class=&quot;wikilink1&quot; title=&quot;tag:react&quot; rel=&quot;tag&quot;&gt;react&lt;/a&gt;,
	&lt;a href=&quot;https://wiki.moorper.com/tag:ace?do=showtag&amp;amp;tag=ace&quot; class=&quot;wikilink1&quot; title=&quot;tag:ace&quot; rel=&quot;tag&quot;&gt;ace&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
</description>
    </item>
</rdf:RDF>
