@@ -35,9 +35,6 @@ import androidx.appcompat.app.AppCompatActivity
3535import androidx.appcompat.content.res.AppCompatResources
3636import androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback
3737import androidx.core.content.FileProvider
38- import kotlinx.coroutines.Dispatchers
39- import kotlinx.coroutines.GlobalScope
40- import kotlinx.coroutines.launch
4138import org.wordpress.android.util.AppLog
4239import org.wordpress.android.util.ImageUtils
4340import org.wordpress.android.util.PermissionUtils
@@ -51,8 +48,6 @@ import org.wordpress.aztec.IHistoryListener
5148import org.wordpress.aztec.ITextFormat
5249import org.wordpress.aztec.glideloader.GlideImageLoader
5350import org.wordpress.aztec.glideloader.GlideVideoThumbnailLoader
54- import org.wordpress.aztec.placeholders.ImageWithCaptionAdapter
55- import org.wordpress.aztec.placeholders.PlaceholderManager
5651import org.wordpress.aztec.plugins.CssUnderlinePlugin
5752import org.wordpress.aztec.plugins.IMediaToolbarButton
5853import org.wordpress.aztec.plugins.shortcodes.AudioShortcodePlugin
@@ -193,10 +188,40 @@ open class MainActivity : AppCompatActivity(),
193188 private val MARK = " <p>Donec ipsum dolor, <mark style=\" color:#ff0000\" >tempor sed</mark> bibendum <mark style=\" color:#1100ff\" >vita</mark>.</p>"
194189
195190 private val EXAMPLE =
196- """ <p>Line 1</p>
197- <placeholder height="0.5f" type="image_with_caption" caption="Image 1" src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/26/Six_eggs_views_from_the_top_on_a_white_background.jpg/440px-Six_eggs_views_from_the_top_on_a_white_background.jpg" />
198- <p>Line 2</p>
199- """ .trimIndent()
191+ IMG +
192+ HEADING +
193+ BOLD +
194+ ITALIC +
195+ UNDERLINE +
196+ STRIKETHROUGH +
197+ TASK_LIST +
198+ ORDERED +
199+ ORDERED_WITH_START +
200+ ORDERED_REVERSED +
201+ ORDERED_REVERSED_WITH_START +
202+ ORDERED_REVERSED_NEGATIVE_WITH_START +
203+ ORDERED_REVERSED_WITH_START_IDENT +
204+ LINE +
205+ UNORDERED +
206+ QUOTE +
207+ PREFORMAT +
208+ LINK +
209+ HIDDEN +
210+ COMMENT +
211+ COMMENT_MORE +
212+ COMMENT_PAGE +
213+ CODE +
214+ UNKNOWN +
215+ EMOJI +
216+ NON_LATIN_TEXT +
217+ LONG_TEXT +
218+ VIDEO +
219+ VIDEOPRESS +
220+ VIDEOPRESS_2 +
221+ AUDIO +
222+ GUTENBERG_CODE_BLOCK +
223+ QUOTE_RTL +
224+ MARK
200225
201226 private val isRunningTest: Boolean by lazy {
202227 try {
@@ -229,7 +254,6 @@ open class MainActivity : AppCompatActivity(),
229254
230255 private var mIsKeyboardOpen = false
231256 private var mHideActionBarOnSoftKeyboardUp = false
232- private lateinit var placeholderManager: PlaceholderManager
233257
234258 override fun onActivityResult (requestCode : Int , resultCode : Int , data : Intent ? ) {
235259 if (resultCode == Activity .RESULT_OK ) {
@@ -403,14 +427,15 @@ open class MainActivity : AppCompatActivity(),
403427 }
404428 }
405429
406- placeholderManager = PlaceholderManager (visualEditor, findViewById(R .id.container_frame_layout))
407- placeholderManager.registerAdapter(ImageWithCaptionAdapter ())
408-
409430 val galleryButton = MediaToolbarGalleryButton (toolbar)
410431 galleryButton.setMediaToolbarButtonClickListener(object : IMediaToolbarButton .IMediaToolbarClickListener {
411432 override fun onClick (view : View ) {
412- GlobalScope .launch(Dispatchers .Main ) {
413- ImageWithCaptionAdapter .insertImageWithCaption(placeholderManager, " https://sample-videos.com/img/Sample-png-image-100kb.png" , " Image 2" )
433+ mediaMenu = PopupMenu (this @MainActivity, view)
434+ mediaMenu?.setOnMenuItemClickListener(this @MainActivity)
435+ mediaMenu?.inflate(R .menu.menu_gallery)
436+ mediaMenu?.show()
437+ if (view is ToggleButton ) {
438+ view.isChecked = false
414439 }
415440 }
416441 })
@@ -438,7 +463,6 @@ open class MainActivity : AppCompatActivity(),
438463 .setOnVideoTappedListener(this )
439464 .setOnAudioTappedListener(this )
440465 .addOnMediaDeletedListener(this )
441- .addOnMediaDeletedListener(placeholderManager)
442466 .setOnVideoInfoRequestedListener(this )
443467 .addPlugin(WordPressCommentsPlugin (visualEditor))
444468 .addPlugin(MoreToolbarButton (visualEditor))
@@ -449,7 +473,6 @@ open class MainActivity : AppCompatActivity(),
449473 .addPlugin(HiddenGutenbergPlugin (visualEditor))
450474 .addPlugin(galleryButton)
451475 .addPlugin(cameraButton)
452- .addPlugin(placeholderManager)
453476
454477 // initialize the plugins, text & HTML
455478 if (! isRunningTest) {
0 commit comments