Upgrade to Pro — share decks privately, control downloads, hide ads and more …

カスタムブロック作成手順のベタープラクティス

 カスタムブロック作成手順のベタープラクティス

2021年11月13日(土)にオンライン開催されたMTDDC Meetup TOKYO 2021のセッションで使用したスライドです。

Yausufmi Nishiyama

November 13, 2021
Tweet

More Decks by Yausufmi Nishiyama

Other Decks in Technology

Transcript

  1. #mtddc ϒϩοΫΤσΟλͰར༻Ͱ͖ΔϒϩοΫ ϓϦηοτ͞Ε͍ͯΔ΋ͷ ʢσϑΥϧτϒϩοΫʣ ςΩετϒϩοΫ ը૾ ϑΝΠϧ )5.- P&NCFE ܩઢ

    ςʔϒϧ ϚϧνΧϥϜ ΦϦδφϧͰ৽͘͠࡞Δ΋ͷ ʢΧελϜϒϩοΫʣ ΧελϜεΫϦϓτ NU#MPDL&EJUPS#MPDLT
  2. #mtddc σϑΥϧτϒϩοΫʢྫɿϚϧνΧϥϜʣΛར༻͢Δ <div class="mt-be-columns" style="display: fl ex" > <div class="mt-be-column"

    > <h2>ޗഐ͸ೣͰ͋Δ</h2 > <p>ޗഐ͸ೣͰ͋Δɻ໊લ͸·ͩແ͍ɻͲ͜Ͱɾɾɾɹ</p> </div > <div class="mt-be-column" > <p > <img src="https://example.movabletype.io/.assets/cat.jpg " alt="͵͜͞· " width="640 " height="640 " class="asset asset-image " style="max-width:100%;height:auto;display:block" > </p > </div > </div> )5.-ߏ଄ΛมߋͰ͖ͳ͍ͨΊɺ ͜ͷ)5.-ʹ͋ΘͤͯελΠϧʢσβΠϯʣΛ༻ҙ͢Δ
  3. #mtddc ΧελϜϒϩοΫΛ࢖͍ͨ͘ͳΔ <div class="mt-be-columns" style="display: fl ex" > <div class="mt-be-column"

    > <h2>ޗഐ͸ೣͰ͋Δ</h2 > <p>ޗഐ͸ೣͰ͋Δɻ໊લ͸·ͩແ͍ɻͲ͜Ͱɾɾɾɹ</p> </div > <div class="mt-be-column" > <p > <img src="https://example.movabletype.io/.assets/cat.jpg " alt="͵͜͞· " width="640 " height="640 " class="asset asset-image " style="max-width:100%;height:auto;display:block" > </p > </div > </div> ผͷDMBTTΛೖΕ͍ͨ TUZMFଐੑ͸ආ͚͍ͨ IʹDMBTTΛ௥Ճ͍ͨ͠ ೖΕࢠͷEJWΛ௥Ճ͍ͨ͠ σβΠϯ͞Εͨ)5.-Λ४උ͠ɺ ͦΕʹ͋Θͤͨ)5.-ߏ଄Λ࡞Δ
  4. #mtddc ϒϩοΫΤσΟλͰར༻Ͱ͖ΔϒϩοΫ ϓϦηοτ͞Ε͍ͯΔ΋ͷ ʢσϑΥϧτϒϩοΫʣ ςΩετϒϩοΫ ը૾ ϑΝΠϧ )5.- P&NCFE ܩઢ

    ςʔϒϧ ϚϧνΧϥϜ ΦϦδφϧͰ৽͘͠࡞Δ΋ͷ ʢΧελϜϒϩοΫʣ ΧελϜεΫϦϓτ NU#MPDL&EJUPS#MPDLT ࠓ೔ɺ͓࿩͢Δ෦෼
  5. #mtddc ϒϩοΫΤσΟλͰར༻Ͱ͖ΔϒϩοΫ ϓϦηοτ͞Ε͍ͯΔ΋ͷ ʢσϑΥϧτϒϩοΫʣ ςΩετϒϩοΫ ը૾ ϑΝΠϧ )5.- P&NCFE ܩઢ

    ςʔϒϧ ϚϧνΧϥϜ ΦϦδφϧͰ৽͘͠࡞Δ΋ͷ ʢΧελϜϒϩοΫʣ ΧελϜεΫϦϓτ NU#MPDL&EJUPS#MPDLT
  6. #mtddc ΧελϜεΫϦϓτ NU#MPDL&EJUPS#MPDLT ‣ +BWB4DSJQUͰෳࡶͳՃ޻Λߦ͏͜ͱ͕Ͱ͖Δ ‣ ฤूը໘Ͱ΋ग़ྗͱಉ݁͡ՌΛදࣔ͢Δ͜ͱ͕Ͱ͖Δ ‣ ΧελϜεΫϦϓτΛมߋͯ͠΋ग़ྗͨ͠಺༰͸มߋ͞Εͳ͍ ‣

    .5λάΛ૊Έ߹ΘͤͨΧελϚΠζΛߦ͏͜ͱ͕Ͱ͖Δ ‣ ͭͷιʔε͔Βɺෳ਺ͷग़ྗΛಘΔ͜ͱ͕Ͱ͖Δ ‣ .5.-ͷมߋͰޙ͔Βग़ྗͨ͠಺༰ΛมߋͰ͖Δ
  7. #mtddc ΧελϜεΫϦϓτ NU#MPDL&EJUPS#MPDLT ‣ +BWB4DSJQUͰෳࡶͳՃ޻Λߦ͏͜ͱ͕Ͱ͖Δ ‣ ฤूը໘Ͱ΋ग़ྗͱಉ݁͡ՌΛදࣔ͢Δ͜ͱ͕Ͱ͖Δ ‣ ΧελϜεΫϦϓτΛมߋͯ͠΋ग़ྗͨ͠಺༰͸มߋ͞Εͳ͍ ‣

    .5λάΛ૊Έ߹ΘͤͨΧελϚΠζΛߦ͏͜ͱ͕Ͱ͖Δ ‣ ͭͷιʔε͔Βɺෳ਺ͷग़ྗΛಘΔ͜ͱ͕Ͱ͖Δ ‣ .5.-ͷมߋͰޙ͔Βग़ྗͨ͠಺༰ΛมߋͰ͖Δ K2VFSZͰ΋0, ׬੒ޙ͕ΠϝʔδͰ͖Δ
  8. #mtddc ϒϩοΫΤσΟλͰར༻Ͱ͖ΔϒϩοΫ ϓϦηοτ͞Ε͍ͯΔ΋ͷ ʢσϑΥϧτϒϩοΫʣ ςΩετϒϩοΫ ը૾ ϑΝΠϧ )5.- P&NCFE ܩઢ

    ςʔϒϧ ϚϧνΧϥϜ ΦϦδφϧͰ৽͘͠࡞Δ΋ͷ ʢΧελϜϒϩοΫʣ ΧελϜεΫϦϓτ NU#MPDL&EJUPS#MPDLT ࠓ೔ɺ͓࿩͢Δ෦෼
  9. #mtddc <div class="timeline"> <div class="block"> <div class="year">2010 </div> <div class="detail">

    <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Mee <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.png" alt="" width="1 </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div> </div> </div> </div> <div class="block"> <div class="year">2011 </div> <div class="detail"> <dl class="group"> <dt class="month">04.16</dt> <dd class="description">MTDDC Meetup NAGOYA 2011</dd> <dt class="month">06.25</dt> <dd class="description"> <a href="https://www.movabletype.jp/blog/mtddc_meetup_tokyo_2011.html">M </dd> </dl>
  10. #mtddc <div class="timeline"> <div class="block"> <div class="year">2010 </div> <div class="detail">

    <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Mee <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.png" alt="" width="1 </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div> </div> </div> </div> <div class="block"> <div class="year">2011 </div> <div class="detail"> <dl class="group"> <dt class="month">04.16</dt> <dd class="description">MTDDC Meetup NAGOYA 2011</dd> <dt class="month">06.25</dt> <dd class="description"> <a href="https://www.movabletype.jp/blog/mtddc_meetup_tokyo_2011.html">M </dd> </dl>
  11. #mtddc <div class="timeline"> <div class="block"> <div class="year">2010 </div> <div class="detail">

    <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Mee <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.png" alt="" width="1 </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div> </div> </div> </div> <div class="block"> <div class="year">2011 </div> <div class="detail"> <dl class="group"> <dt class="month">04.16</dt> <dd class="description">MTDDC Meetup NAGOYA 2011</dd> <dt class="month">06.25</dt> <dd class="description"> <a href="https://www.movabletype.jp/blog/mtddc_meetup_tokyo_2011.html">M </dd> </dl> EJWCMPDL
  12. #mtddc <div class="timeline"> <div class="block"> <div class="year">2010 </div> <div class="detail">

    <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Mee <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.png" alt="" width="1 </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div> ᶃΠϕϯτ։࠵೔ͱͦͷ಺༰
  13. #mtddc <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup

    FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Mee <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.png" alt="" width="1 </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div> </div> </div> </div> <div class="block"> <div class="year">2011 </div> <div class="detail"> <dl class="group"> <dt class="month">04.16</dt> ᶄίϝϯτ಺ͷςΩετͱը૾
  14. #mtddc ᶄίϝϯτ಺ͷը૾ ίϯςφཁૉͰแΉɿ0/ Ϋϥε໊ɿJNHCMPDL ϙΠϯτ <div class="img-block left"> < fi

    gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/ </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div>
  15. #mtddc <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup

    FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Mee <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.png" alt="" width="1 </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div> </div> </div> </div> <div class="block"> <div class="year">2011 </div> <div class="detail"> <dl class="group"> <dt class="month">04.16</dt> ᶅίϝϯτ
  16. #mtddc <div class="timeline"> <div class="block"> <div class="year">2010 </div> <div class="detail">

    <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Mee <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.png" alt="" width="1 </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div> ᶆΠϕϯτ։࠵೥
  17. #mtddc ᶆΠϕϯτ։࠵೥ ϙΠϯτ ௥ՃՄೳͳϒϩοΫ ɾ݄೔ ɾίϝϯτ ίϯςφཁૉͰแΉɿ0/ Ϋϥε໊ɿCMPDL ϒϩοΫͷ௥Ճͱ࡟আɿ0/ <div

    class="timeline"> <div class="block"> <div class="year">2010 </div> <div class="detail"> <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSH </dd> </dl> <div class="comment"> <p> Movable Type <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.pn </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div>
  18. #mtddc <div class="timeline"> <div class="block"> <div class="year">2010 </div> <div class="detail">

    <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Mee <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/demo_html/2010_fukushima.png" alt="" width="1 </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 </div> </div> ᶇλΠϜϥΠϯશମ
  19. #mtddc <div class="timeline"> <div class="block"> <p class="year">2010 </p> <p class="month">11.06</p>

    <p class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSHIMA 2010</a> </p> <div class="comment"> <p> Movable Type MTDDC Meetup <div class="img-block"> <p class="position">left</p> <p class="img-block__img"> <img src="https://www.ni4.jp/.assets/2010_fukushima.png" alt="" width="1099" height="685" class="asset a </p> <p class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 80 <br> <br> <a href="http://mtddc.d-s-b.jp/2010/report/">MTDDC Meetup FUKUSHIMA </a> </p> )5.-λά͕ҧ͏͔ΒɺελΠϧ͕ద༻͞Εͳ͍ ϒϩοΫͷλά͕ҧ͏ ඞཁͳϒϩοΫ͕ͳ͍
  20. #mtddc <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="*****************************************" crossorigin="anonymous"></script> <script> $(function(){ if (document.body.dataset.hasCompiledHtml) {

    return; } // HTML var html = document.querySelector('.timeline').outerHTML; MTBlockEditorSetCompiledHtml(html); }); </script> ΧελϜεΫϦϓτΛॻ͘ ࢲ͕͍ͭ΋࢖͏ςϯϓϨʔτ +BWB4DSJQU ɾK2VFSZΛ࢖༻ ɾ਌ϒϩοΫͷ)5.-Λ·Δͬͱग़ྗ ɹͪͳΈʹɺࢲͷ+BWB4DSJQUεΩϧ͸௿͍Ͱ͢ʜ
  21. #mtddc // $('.year').replaceWith(function() { var year = $(this).text(); $(this).replaceWith('<div class="year">'

    + year + '</div>') }); // $('img').removeAttr('style class'); $('.img-block__img').replaceWith(function() { var img = $(this).html(); $(this).replaceWith('< fi gure class="img-block__img">' + img + '</ fi gure>') }); ࠓճॻ͍͍ͯΔ಺༰ʢൈਮʣ QλάΛEJW΍ fi HVSFʹஔ͖׵͑ TUZMFଐੑ΍DMBTTଐੑΛ࡟আ
  22. #mtddc // $('.img-block').each(function(){ var position = $(this). fi nd('.position').text(); $(this).addClass(position);});

    $('.position').remove(); // $('.block').wrapInner('<div class="detail">'); $('.detail').wrapInner('<dl class="group">'); // $('.block').each(function(){ $(this). fi nd('.year').insertBefore($(this). fi nd(".detail")); }); $('.block').each(function(){ $(this). fi nd('.comment').insertAfter($(this). fi nd(".group")); }); ࠓճॻ͍͍ͯΔ಺༰ʢൈਮʣ ը૾഑ஔ༻ͷDMBTTΛ਌ϒϩοΫʹ͚ͭΔ ϒϩοΫͰғͬͨΓɺॱংΛೖΕସ͑ͨΓ
  23. #mtddc <div class="timeline"> <div class="block"> <div class="year">2010 </div> <div class="detail">

    <dl class="group"> <dt class="month">11.06</dt> <dd class="description"> <a href="http://mtddc.d-s-b.jp/2010/">MTDDC Meetup FUKUSHIMA 2010</a> </dd> </dl> <div class="comment"> <p> Movable Type MTDDC Meetup <div class="img-block left"> < fi gure class="img-block__img"> <img src="https://www.ni4.jp/.assets/2010_fukushima.png?" alt="" width="1099" height="685"> </ fi gure> <div class="img-block__text"> MTDDC Meetup FUKUSHIMA 2010 80 <br> <br> )5.-λά͕ॻ͖׵͑ΒΕɺελΠϧ͕ద༻͞Ε͍ͯΔ ਖ਼͍͠ϒϩοΫͷλά ඞཁͳϒϩοΫ͕ἧ͏