strapi-plugin-copy-any-component 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,146 +14,115 @@ A powerful Strapi plugin that allows you to copy and reorder components (section
14
14
  - ⚙️ **Zero-Code Configuration**: Configure via admin panel - settings persist across restarts
15
15
  - 📸 **Media Support**: Properly handles media files and images
16
16
  - 💾 **Draft/Publish System**: Changes are saved as drafts, publish when ready
17
- - ✅ **Detailed Feedback**: See exactly what fields and media were copied
18
- - 🌐 **Universal**: Works with any content type (Page, Article, Blog, etc.) and any dynamic zone field
19
17
 
20
- ## 🔍 Automatic Content Type Detection
18
+ ## 📦 Installation
21
19
 
22
- This plugin works with **any content type** and **any dynamic zone**! The plugin automatically:
20
+ ```bash
21
+ npm install strapi-plugin-copy-any-component
22
+ ```
23
23
 
24
- - Detects all custom content types (Page, Article, Blog, LandingPage, etc.)
25
- - Finds all fields containing dynamic zones (sections, blocks, content, etc.)
26
- - Provides a dropdown interface in the admin panel for easy selection
24
+ That's it! The plugin will be automatically detected by Strapi.
27
25
 
28
- ### Admin Panel Configuration (No Code Required!)
26
+ > **Note:** No need to add anything to `config/plugins.ts` - Strapi automatically picks up plugins installed via npm.
29
27
 
30
- 1. Go to the plugin page
31
- 2. Click the **⚙️ Content Type Settings** button in the top right
32
- 3. Select your desired **Content Type** and **Dynamic Zone**
33
- 4. Click **💾 Save**
28
+ ### Set Permissions
34
29
 
35
- Settings are **automatically saved** and persist even after Strapi restarts! No need to edit code.
30
+ After installation, you need to enable permissions:
36
31
 
37
- ## 📖 Documentation
32
+ 1. Go to **Settings > Users & Permissions > Roles** in Strapi admin
33
+ 2. Select your role (e.g., Super Admin, Editor)
34
+ 3. Find **Copy Any Component** section
35
+ 4. Enable all permissions:
36
+ - Access Component Copy pages
37
+ - Copy components
38
+ - Update page sections
39
+ - Publish pages
40
+ 5. Save
38
41
 
39
- - **[QUICK_START.md](./QUICK_START.md)** - Hızlı başlangıç rehberi (önerilen)
40
- - **[INSTALLATION.md](./INSTALLATION.md)** - Detaylı kurulum rehberi
41
- - **[USAGE.md](./USAGE.md)** - Kullanım rehberi ve örnekler
42
- - **[TESTING.md](./TESTING.md)** - Test rehberi
42
+ ### Restart Strapi
43
43
 
44
- ## ✨ Features
45
-
46
- - 🎯 **Drag & Drop Interface**: Intuitive visual interface for copying components
47
- - 📋 **Component Copying**: Copy components from one page to another
48
- - 🔄 **Component Reordering**: Reorder components within a page
49
- - 🔍 **Auto-Detection**: Automatically detects all content types and dynamic zones
50
- - ⚙️ **Zero-Code Configuration**: Configure via admin panel - settings persist across restarts
51
- - 📸 **Media Support**: Properly handles media files and images
52
- - 💾 **Draft/Publish System**: Changes are saved as drafts, publish when ready
53
- - ✅ **Detailed Feedback**: See exactly what fields and media were copied
54
- - 🌐 **Universal**: Works with any content type (Page, Article, Blog, etc.) and any dynamic zone field
55
-
56
- ## 📦 Installation
44
+ ```bash
45
+ npm run develop
46
+ ```
57
47
 
58
- ### NPM Install (Recommended)
48
+ ## 🚀 Usage
59
49
 
60
- ```bash
61
- npm install strapi-plugin-copy-any-component
50
+ 1. Go to **Plugins > Copy Any Component** in Strapi admin panel
51
+ 2. Click **⚙️ Content Type Settings** to select your content type and dynamic zone
52
+ 3. Select **Source Page** (left) and **Target Page** (right)
53
+ 4. Drag components from Source to Target
54
+ 5. Reorder by dragging within Target
55
+ 6. Click **Publish** to save
56
+
57
+ ## 🔧 Optional Configuration
58
+
59
+ If you want to set default content type, add to `config/plugins.ts`:
60
+
61
+ ```typescript
62
+ export default () => ({
63
+ 'copy-any-component': {
64
+ enabled: true,
65
+ config: {
66
+ contentType: 'api::page.page',
67
+ dynamicZoneField: 'sections',
68
+ },
69
+ },
70
+ });
62
71
  ```
63
72
 
64
- ### Manual Install
65
-
66
- 1. **Install the plugin:**
67
- ```bash
68
- npm install strapi-plugin-copy-any-component
69
- ```
70
-
71
- 2. **Register the plugin** in `config/plugins.ts`:
72
- ```typescript
73
- export default () => ({
74
- 'copy-any-component': {
75
- enabled: true,
76
- resolve: './node_modules/strapi-plugin-copy-any-component',
77
- // Optional: Set defaults (can be changed via admin panel)
78
- config: {
79
- contentType: 'api::page.page',
80
- dynamicZoneField: 'sections',
81
- },
82
- },
83
- });
84
- ```
85
-
86
- 3. **Set permissions:**
87
- - Go to **Settings > Users & Permissions > Roles** in Strapi admin
88
- - Enable permissions for **Copy Any Component** section:
89
- - Access Component Copy pages
90
- - Copy components
91
- - Update page sections
92
- - Publish pages
93
-
94
- 4. **Restart Strapi:**
95
- ```bash
96
- npm run develop
97
- ```
98
-
99
- ### Configuration
100
-
101
- The plugin can be configured in two ways:
102
-
103
- 1. **Via Admin Panel (Recommended)**: No code required! Settings persist automatically.
104
- 2. **Via Config File**: Edit `config/plugins.ts` as shown above.
105
-
106
- For detailed installation instructions, see [INSTALLATION.md](./INSTALLATION.md).
73
+ ## Requirements
107
74
 
108
- ## 🚀 Usage
75
+ - Strapi 5.0.0 or higher
76
+ - Node.js 18.x or higher
109
77
 
110
- For detailed usage instructions, see [USAGE.md](./USAGE.md).
78
+ ## ⚠️ Troubleshooting
111
79
 
112
- ### Basic Usage
80
+ ### Version Mismatch / Build Errors
113
81
 
114
- 1. Go to **Plugins > Copy Any Component** in Strapi admin panel
115
- 2. **Source Page** (left panel) - Select the page you want to copy components from
116
- 3. **Target Page** (right panel) - Select the page you want to copy components to
117
- 4. Drag components from Source Page and drop them on Target Page
118
- 5. Reorder components in Target Page by dragging them
119
- 6. Click **Publish** to save changes
82
+ If you see errors like `useAIAvailability` or other export errors after installing the plugin:
120
83
 
121
- ### Configuration via Admin Panel
84
+ ```bash
85
+ # 1. Remove the plugin temporarily
86
+ npm uninstall strapi-plugin-copy-any-component
122
87
 
123
- 1. Click **⚙️ Content Type Settings** button in the plugin page
124
- 2. Select your **Content Type** (e.g., Page, Article, Blog)
125
- 3. Select your **Dynamic Zone Field** (e.g., sections, blocks, content)
126
- 4. Click **💾 Save** - settings persist automatically!
88
+ # 2. Clean everything
89
+ rm -rf node_modules package-lock.json .cache dist
127
90
 
128
- ## 🔌 API Endpoints
91
+ # 3. Update React versions in package.json to ^18.2.0
129
92
 
130
- ### Admin Routes
93
+ # 4. Reinstall all dependencies
94
+ npm install
131
95
 
132
- - `GET /admin/plugins/copy-any-component/pages` - List all pages
133
- - `GET /admin/plugins/copy-any-component/pages/:pageId/sections` - Get page sections
134
- - `GET /admin/plugins/copy-any-component/content-types` - List available content types
135
- - `PUT /admin/plugins/copy-any-component/config` - Update plugin configuration
136
- - `POST /admin/plugins/copy-any-component/pages/:sourcePageId/copy-to/:targetPageId` - Copy sections
137
- - `PUT /admin/plugins/copy-any-component/pages/:pageId/sections` - Update page sections (reorder)
138
- - `POST /admin/plugins/copy-any-component/pages/:pageId/publish` - Publish page
96
+ # 5. Install plugin again
97
+ npm install strapi-plugin-copy-any-component
139
98
 
140
- ### Content API Routes
99
+ # 6. Build and run
100
+ npm run build
101
+ npm run develop
102
+ ```
141
103
 
142
- - `GET /api/copy-any-component/pages/:pageId/sections` - Get page sections
143
- - `POST /api/copy-any-component/pages/:sourcePageId/copy-to/:targetPageId` - Copy sections
104
+ ### `flushSync` Error
144
105
 
145
- ## Permissions
106
+ If you see:
107
+ ```
108
+ SyntaxError: The requested module 'react-dom' does not provide an export named 'flushSync'
109
+ ```
146
110
 
147
- Make sure to grant permissions in **Settings > Users & Permissions > Roles**:
148
- - Access Component Copy pages
149
- - Copy components
150
- - Update page sections
151
- - Publish pages
111
+ Update your project's React version in `package.json`:
112
+ ```json
113
+ {
114
+ "dependencies": {
115
+ "react": "^18.2.0",
116
+ "react-dom": "^18.2.0"
117
+ }
118
+ }
119
+ ```
152
120
 
153
- ## Requirements
121
+ ### Plugin not visible
154
122
 
155
- - Strapi 5.0.0 or higher
156
- - Node.js 20.x or higher
123
+ - Check permissions in Settings > Roles
124
+ - Restart Strapi: `npm run develop`
125
+ - Clear cache: `rm -rf .cache dist`
157
126
 
158
127
  ## License
159
128
 
@@ -161,5 +130,4 @@ MIT
161
130
 
162
131
  ## Support
163
132
 
164
- For issues and questions, please open an issue on GitHub.
165
-
133
+ For issues, please open an issue on [GitHub](https://github.com/metehankasapp/strapi-plugin-copy-any-component/issues).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-copy-any-component",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A powerful Strapi plugin that allows you to copy and reorder components (sections) between pages using an intuitive drag-and-drop interface. Works with any content type and dynamic zone - no code required!",
5
5
  "keywords": [
6
6
  "strapi",
@@ -36,19 +36,19 @@
36
36
  "strapi-admin.js",
37
37
  "strapi-server.js",
38
38
  "admin",
39
- "server",
40
- "README.md",
41
- "INSTALLATION.md",
42
- "USAGE.md",
43
- "QUICK_START.md",
44
- "TESTING.md"
39
+ "server/src/services",
40
+ "README.md"
45
41
  ],
46
42
  "scripts": {
47
43
  "test": "echo \"Error: no test specified\" && exit 1"
48
44
  },
49
45
  "dependencies": {},
50
46
  "peerDependencies": {
51
- "@strapi/strapi": "^5.0.0"
47
+ "@strapi/strapi": ">=5.0.0",
48
+ "@strapi/design-system": ">=2.0.0",
49
+ "@strapi/icons": ">=2.0.0",
50
+ "react": "^18.0.0",
51
+ "react-dom": "^18.0.0"
52
52
  },
53
53
  "author": {
54
54
  "name": "Metehan Kasap",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "license": "MIT",
58
58
  "engines": {
59
- "node": ">=18.0.0 <=20.x.x",
59
+ "node": ">=18.0.0 <=24.x.x",
60
60
  "npm": ">=6.0.0"
61
61
  }
62
62
  }
package/INSTALLATION.md DELETED
@@ -1,179 +0,0 @@
1
- # Component Copy Plugin - Kurulum Rehberi
2
-
3
- Bu rehber, Component Copy plugin'ini başka bir Strapi projesinde kullanmak için gerekli adımları içerir.
4
-
5
- ## Önkoşullar
6
-
7
- - Strapi 5.0.0 veya üzeri
8
- - Node.js 20.x veya üzeri
9
- - Mevcut bir Page content type'ı (sections dynamic zone ile)
10
-
11
- ## Kurulum Adımları
12
-
13
- ### 1. Plugin'i Kopyalayın
14
-
15
- Plugin klasörünü hedef Strapi projenizin `src/plugins/` dizinine kopyalayın:
16
-
17
- ```bash
18
- # Mevcut projeden
19
- cp -r /path/to/source/strapi/src/plugins/my-simple-plugin /path/to/target/strapi/src/plugins/
20
-
21
- # veya Git kullanarak
22
- git clone <repository-url> /path/to/target/strapi/src/plugins/my-simple-plugin
23
- ```
24
-
25
- ### 2. Plugin'i Kaydedin
26
-
27
- Hedef projede `config/plugins.ts` dosyasını düzenleyin:
28
-
29
- ```typescript
30
- export default () => ({
31
- 'my-simple-plugin': {
32
- enabled: true,
33
- resolve: './src/plugins/my-simple-plugin',
34
- },
35
- });
36
- ```
37
-
38
- Eğer `config/plugins.js` kullanıyorsanız:
39
-
40
- ```javascript
41
- module.exports = {
42
- 'my-simple-plugin': {
43
- enabled: true,
44
- resolve: './src/plugins/my-simple-plugin',
45
- },
46
- };
47
- ```
48
-
49
- ### 3. Gerekli Content Type'ı Kontrol Edin
50
-
51
- Plugin, `api::page.page` content type'ını kullanır. Bu content type'ın şu özelliklere sahip olması gerekir:
52
-
53
- - **Dynamic Zone**: `sections` adında bir dynamic zone field
54
- - **Slug**: Sayfaları tanımlamak için slug field'ı
55
-
56
- Eğer farklı bir content type kullanıyorsanız, plugin kodunu düzenlemeniz gerekebilir.
57
-
58
- #### Örnek Page Schema:
59
-
60
- ```json
61
- {
62
- "kind": "collectionType",
63
- "collectionName": "pages",
64
- "info": {
65
- "singularName": "page",
66
- "pluralName": "pages",
67
- "displayName": "Page"
68
- },
69
- "attributes": {
70
- "title": {
71
- "type": "string",
72
- "required": true
73
- },
74
- "slug": {
75
- "type": "uid",
76
- "targetField": "title",
77
- "required": true
78
- },
79
- "sections": {
80
- "type": "dynamiczone",
81
- "components": [
82
- // Component listesi buraya gelecek
83
- ]
84
- }
85
- }
86
- }
87
- ```
88
-
89
- ### 4. İzinleri Ayarlayın
90
-
91
- Strapi admin panelinde şu adımları izleyin:
92
-
93
- 1. **Settings > Users & Permissions > Roles** sayfasına gidin
94
- 2. İlgili role'ü seçin (örn: Authenticated, Public)
95
- 3. **My Simple Plugin** bölümünü bulun
96
- 4. Şu izinleri etkinleştirin:
97
- - `find` - Sayfaları listelemek için
98
- - `getPageSections` - Section'ları görmek için
99
- - `copySections` - Component'leri kopyalamak için
100
- - `updatePageSections` - Section'ları güncellemek için
101
- - `publish` - Sayfaları yayınlamak için
102
-
103
- ### 5. Strapi'yi Yeniden Başlatın
104
-
105
- ```bash
106
- npm run develop
107
- # veya production için
108
- npm run build
109
- npm run start
110
- ```
111
-
112
- ### 6. Plugin'i Kullanın
113
-
114
- 1. Strapi admin panelinde **Plugins** menüsüne gidin
115
- 2. **Component Copy** seçeneğini bulun
116
- 3. Plugin arayüzünü kullanarak component'leri kopyalayın
117
-
118
- ## Farklı Content Type Kullanımı
119
-
120
- Eğer `page` yerine farklı bir content type kullanıyorsanız (örneğin `article`, `post`), plugin kodunda aşağıdaki dosyaları güncellemeniz gerekir:
121
-
122
- 1. `server/src/services/component-copy.js` - Tüm `api::page.page` referanslarını değiştirin
123
- 2. `strapi-server.js` - Controller'lardaki `api::page.page` referanslarını değiştirin
124
- 3. `admin/src/pages/HomePage.jsx` - API endpoint'lerini kontrol edin (genellikle değişmez)
125
-
126
- **Örnek değişiklik:**
127
-
128
- ```javascript
129
- // Eski
130
- await strapi.entityService.findOne("api::page.page", pageId, ...)
131
-
132
- // Yeni (article için)
133
- await strapi.entityService.findOne("api::article.article", pageId, ...)
134
- ```
135
-
136
- ## Sorun Giderme
137
-
138
- ### Plugin görünmüyor
139
-
140
- - `config/plugins.ts` dosyasının doğru yapılandırıldığından emin olun
141
- - Strapi'yi yeniden başlatın
142
- - `dist` klasörünü temizleyin: `rm -rf dist .cache`
143
-
144
- ### "Page not found" hatası
145
-
146
- - Page content type'ının doğru şekilde oluşturulduğundan emin olun
147
- - Slug field'ının mevcut olduğunu kontrol edin
148
- - Sections dynamic zone'ın tanımlı olduğunu doğrulayın
149
-
150
- ### Component'ler kopyalanmıyor
151
-
152
- - İzinlerin doğru ayarlandığından emin olun
153
- - Browser console'da hata mesajlarını kontrol edin
154
- - Network tab'inde API isteklerinin başarılı olduğunu doğrulayın
155
-
156
- ### Media dosyaları kopyalanmıyor
157
-
158
- - Media library'de dosyaların mevcut olduğundan emin olun
159
- - Media field'larının populate edildiğinden emin olun
160
- - Component schema'larında media field'larının doğru tanımlandığını kontrol edin
161
-
162
- ## Önemli Notlar
163
-
164
- 1. **Bootstrap Fonksiyonu**: Mevcut projedeki `src/index.ts` dosyasında bootstrap kodu varsa, bu kod hedef projede çalışmayabilir. Bootstrap kodunu yalnızca test/development için kullanıyorsanız, production'da kaldırmak isteyebilirsiniz.
165
-
166
- 2. **Component'ler**: Plugin, dynamic zone içindeki tüm component'leri destekler. Kendi component'lerinizi kullanabilirsiniz.
167
-
168
- 3. **Performance**: Çok sayıda component'i kopyalarken performans etkilenebilir. Büyük component'ler için dikkatli olun.
169
-
170
- 4. **Backup**: Component kopyalama işleminden önce veritabanınızı yedeklemeyi unutmayın.
171
-
172
- ## Destek
173
-
174
- Sorun yaşarsanız:
175
- 1. Browser console'da hata mesajlarını kontrol edin
176
- 2. Strapi log'larını inceleyin
177
- 3. Plugin'in doğru kurulduğundan emin olun
178
- 4. İzinlerin ayarlandığını doğrulayın
179
-
package/QUICK_START.md DELETED
@@ -1,88 +0,0 @@
1
- # Component Copy Plugin - Hızlı Başlangıç
2
-
3
- ## ✅ Kurulum Checklist
4
-
5
- Başka bir Strapi projesinde plugin'i kullanmak için şu adımları izleyin:
6
-
7
- ### 1. Plugin'i Kopyalayın
8
-
9
- ```bash
10
- # Mevcut projeden plugin klasörünü kopyalayın
11
- cp -r /path/to/source/strapi/src/plugins/my-simple-plugin /path/to/target/strapi/src/plugins/
12
- ```
13
-
14
- ### 2. Plugin'i Kaydedin
15
-
16
- `config/plugins.ts` dosyasına ekleyin:
17
-
18
- ```typescript
19
- export default () => ({
20
- 'my-simple-plugin': {
21
- enabled: true,
22
- resolve: './src/plugins/my-simple-plugin',
23
- },
24
- });
25
- ```
26
-
27
- ### 3. İzinleri Ayarlayın
28
-
29
- Strapi admin panelinde:
30
- - **Settings > Users & Permissions > Roles**
31
- - İlgili role seçin (Authenticated, Public, vb.)
32
- - **My Simple Plugin** bölümündeki tüm izinleri etkinleştirin:
33
- - `find`
34
- - `getPageSections`
35
- - `copySections`
36
- - `updatePageSections`
37
- - `publish`
38
-
39
- ### 4. Strapi'yi Yeniden Başlatın
40
-
41
- ```bash
42
- # Development
43
- npm run develop
44
-
45
- # Production
46
- npm run build
47
- npm run start
48
- ```
49
-
50
- ### 5. Plugin'i Kullanın
51
-
52
- - Admin panelinde **Plugins > Component Copy** menüsüne gidin
53
- - Component'leri kopyalayın ve sıralayın
54
-
55
- ## ⚠️ Önemli Notlar
56
-
57
- 1. **Page Content Type Gerekli**: Plugin `api::page.page` content type'ını kullanır. Bu content type'ın:
58
- - `sections` adında bir dynamic zone field'ı olmalıdır
59
- - `slug` field'ı olmalıdır
60
-
61
- 2. **Farklı Content Type**: Eğer farklı bir content type kullanıyorsanız, plugin kodunda `api::page.page` referanslarını değiştirmeniz gerekir.
62
-
63
- 3. **Bootstrap Kodu**: Mevcut projedeki `src/index.ts` dosyasındaki bootstrap kodu bu plugin'e özel değildir. İsterseniz hedef projede kullanmayabilirsiniz.
64
-
65
- 4. **Component'ler**: Plugin herhangi bir dynamic zone component'ini destekler. Kendi component'lerinizi kullanabilirsiniz.
66
-
67
- ## 🔧 Farklı Content Type Kullanımı
68
-
69
- Eğer `page` yerine başka bir content type kullanıyorsanız:
70
-
71
- 1. `server/src/services/component-copy.js` dosyasında tüm `api::page.page` referanslarını değiştirin
72
- 2. `strapi-server.js` dosyasında controller'lardaki `api::page.page` referanslarını değiştirin
73
-
74
- **Örnek:**
75
- ```javascript
76
- // Eski
77
- api::page.page
78
-
79
- // Yeni (örneğin article için)
80
- api::article.article
81
- ```
82
-
83
- ## 📚 Daha Fazla Bilgi
84
-
85
- - **Detaylı Kurulum**: [INSTALLATION.md](./INSTALLATION.md)
86
- - **Kullanım Rehberi**: [USAGE.md](./USAGE.md)
87
- - **Genel Bilgiler**: [README.md](./README.md)
88
-
package/TESTING.md DELETED
@@ -1,193 +0,0 @@
1
- # Copy Any Component Plugin - Test Rehberi
2
-
3
- Bu rehber, plugin'i test etmek için adım adım talimatlar içerir.
4
-
5
- ## 1. Temel Test
6
-
7
- ### Adım 1: Strapi'yi Başlatın
8
-
9
- ```bash
10
- npm run develop
11
- ```
12
-
13
- ### Adım 2: Admin Panelinde Plugin'e Erişin
14
-
15
- 1. Strapi admin panelinde giriş yapın
16
- 2. Sol menüden **Plugins > Copy Any Component 🎨** seçeneğine tıklayın
17
-
18
- ### Adım 3: Sayfaları Kontrol Edin
19
-
20
- - Source Page (sol panel) ve Target Page (sağ panel) dropdown'larından sayfaları görebilmelisiniz
21
- - Eğer sayfa yoksa, önce Content Manager'da birkaç sayfa oluşturun
22
-
23
- ### Adım 4: Component Kopyalama Testi
24
-
25
- 1. **Source Page** seçin (örneğin: "Ana Sayfa")
26
- 2. **Target Page** seçin (örneğin: "Hakkımızda")
27
- 3. Source Page panelinden bir component'i seçin
28
- 4. Component'i sürükleyip Target Page paneline bırakın
29
- 5. Başarı mesajını görmelisiniz
30
- 6. Target Page panelinde yeni component görünmeli
31
-
32
- ### Adım 5: Kopyalanan Component'i Kontrol Edin
33
-
34
- 1. Content Manager > Pages > Target Page'e gidin
35
- 2. Sayfayı düzenle modunda açın
36
- 3. Kopyalanan component'in tüm field'larının doğru kopyalandığını kontrol edin:
37
- - Text field'lar
38
- - Media dosyaları
39
- - Nested component'ler (button, form-field, vb.)
40
- - Relation field'lar
41
-
42
- ### Adım 6: Publish Testi
43
-
44
- 1. Plugin arayüzüne geri dönün
45
- 2. **Publish** butonuna tıklayın
46
- 3. Başarı mesajını görmelisiniz
47
- 4. Frontend'de değişikliklerin göründüğünü kontrol edin
48
-
49
- ## 2. Farklı Component Tipleri Testi
50
-
51
- Her component tipini test edin:
52
-
53
- - ✅ **Hero Section** - Basit component
54
- - ✅ **CTA Section** - Button component'leri içeren
55
- - ✅ **Stats Section** - Relation (siteSettings) içeren
56
- - ✅ **Form Section** - Nested form-field component'leri içeren
57
- - ✅ **Gallery Section** - Media array içeren
58
- - ✅ **Accordion Section** - Nested accordion-item component'leri içeren
59
- - ✅ **Pricing Section** - Nested pricing-plan component'leri içeren
60
- - ✅ **Timeline Section** - Nested timeline-item component'leri içeren
61
-
62
- Her bir component tipinde:
63
- - Tüm field'ların kopyalandığını doğrulayın
64
- - Nested component'lerin kopyalandığını doğrulayın
65
- - Media dosyalarının referanslarının korunduğunu doğrulayın
66
-
67
- ## 3. Aynı Sayfada Kopyalama Testi
68
-
69
- 1. Aynı sayfayı hem Source hem de Target olarak seçin
70
- 2. Bir component'i kopyalayın
71
- 3. Component'in duplicate (çoğaltıldığını) doğrulayın
72
- 4. Publish edin ve sonucu kontrol edin
73
-
74
- ## 4. Component Sıralama Testi
75
-
76
- 1. Target Page panelinde component'leri seçin
77
- 2. Component'leri sürükleyerek sıralayın
78
- 3. Değişikliklerin otomatik kaydedildiğini kontrol edin
79
- 4. Publish edin ve sonucu kontrol edin
80
-
81
- ## 5. Farklı Content Type Testi (OPSİYONEL)
82
-
83
- Eğer farklı bir content type kullanmak istiyorsanız:
84
-
85
- ### Adım 1: Config'i Güncelleyin
86
-
87
- `config/plugins.ts` dosyasını düzenleyin:
88
-
89
- ```typescript
90
- export default () => ({
91
- 'copy-any-component': {
92
- enabled: true,
93
- resolve: './src/plugins/my-simple-plugin',
94
- config: {
95
- contentType: 'api::article.article', // Farklı content type
96
- dynamicZoneField: 'blocks', // Farklı field name
97
- },
98
- },
99
- });
100
- ```
101
-
102
- ### Adım 2: Strapi'yi Yeniden Başlatın
103
-
104
- ```bash
105
- npm run develop
106
- ```
107
-
108
- ### Adım 3: Yeni Content Type ile Test Edin
109
-
110
- 1. Content Manager'da yeni content type'dan kayıtlar oluşturun
111
- 2. Plugin arayüzünde yeni kayıtları görebilmelisiniz
112
- 3. Component kopyalama işlemini test edin
113
-
114
- ## 6. Hata Senaryoları Testi
115
-
116
- ### Test 1: İzin Hatası
117
-
118
- 1. Gerekli izinleri kapatın (Settings > Users & Permissions > Roles)
119
- 2. Component kopyalamayı deneyin
120
- 3. Uygun hata mesajını görmelisiniz
121
-
122
- ### Test 2: Geçersiz Sayfa ID
123
-
124
- 1. Network tab'ını açın
125
- 2. Component kopyalama işlemini başlatın
126
- 3. API request'ini düzenleyip geçersiz ID gönderin
127
- 4. Uygun hata mesajını görmelisiniz
128
-
129
- ## 7. Performance Testi
130
-
131
- 1. Çok sayıda component içeren bir sayfa oluşturun (10+ component)
132
- 2. Tüm component'leri tek tek kopyalayın
133
- 3. İşlemlerin makul bir sürede tamamlandığını kontrol edin
134
-
135
- ## 8. Browser Console Testi
136
-
137
- 1. Browser Developer Tools'u açın (F12)
138
- 2. Console tab'ına geçin
139
- 3. Component kopyalama işlemini yapın
140
- 4. Herhangi bir JavaScript hatası olmadığını doğrulayın
141
- 5. Network tab'ında API isteklerinin başarılı olduğunu kontrol edin
142
-
143
- ## 9. Detaylı Bilgi Modal Testi
144
-
145
- 1. Bir component'i kopyalayın
146
- 2. Başarı mesajına tıklayın
147
- 3. Detaylı bilgi modal'ının açıldığını kontrol edin
148
- 4. Şu bilgileri doğrulayın:
149
- - Kopyalanan field sayısı
150
- - Media dosyaları
151
- - Kaldırılan sistem field'ları (id, createdAt, vb.)
152
-
153
- ## 10. Frontend Render Testi
154
-
155
- 1. Component'leri kopyalayın ve publish edin
156
- 2. Frontend'de sayfayı açın
157
- 3. Tüm component'lerin doğru render edildiğini kontrol edin:
158
- - Stil'ler doğru mu?
159
- - İçerik doğru mu?
160
- - Media dosyaları görünüyor mu?
161
- - Nested component'ler çalışıyor mu?
162
-
163
- ## Beklenen Sonuçlar
164
-
165
- ✅ **Başarılı Senaryolar:**
166
- - Component'ler sorunsuz kopyalanır
167
- - Tüm field'lar korunur
168
- - Media referansları korunur
169
- - Nested component'ler kopyalanır
170
- - Publish işlemi başarılı olur
171
-
172
- ❌ **Hata Senaryoları:**
173
- - İzin hatası mesajı gösterilir
174
- - Geçersiz sayfa hatası gösterilir
175
- - Network hataları uygun şekilde handle edilir
176
-
177
- ## Sorun Giderme
178
-
179
- ### Component'ler görünmüyor
180
- - Sayfaların publish edildiğinden emin olun
181
- - Browser cache'ini temizleyin
182
- - Strapi'yi yeniden başlatın
183
-
184
- ### Component kopyalanmıyor
185
- - Browser console'da hata var mı kontrol edin
186
- - Network tab'ında API isteklerini kontrol edin
187
- - İzinlerin doğru ayarlandığını kontrol edin
188
-
189
- ### Field'lar kayboluyor
190
- - Browser console log'larını kontrol edin
191
- - Component schema'sını kontrol edin
192
- - Media field'larının doğru populate edildiğinden emin olun
193
-
package/USAGE.md DELETED
@@ -1,121 +0,0 @@
1
- # Component Copy Plugin - Kullanım Rehberi
2
-
3
- ## Temel Kullanım
4
-
5
- ### 1. Plugin'e Erişim
6
-
7
- Strapi admin panelinde sol menüden **Plugins > Component Copy** seçeneğine tıklayın.
8
-
9
- ### 2. Sayfa Seçimi
10
-
11
- - **Source Page (Kaynak Sayfa)**: Component'leri kopyalamak istediğiniz sayfayı seçin
12
- - **Target Page (Hedef Sayfa)**: Component'lerin kopyalanacağı sayfayı seçin
13
-
14
- ### 3. Component Kopyalama
15
-
16
- 1. Source Page panelinden bir component'i seçin
17
- 2. Component'i sürükleyip Target Page paneline bırakın
18
- 3. Component belirtilen pozisyona kopyalanacaktır
19
-
20
- ### 4. Component Sıralama
21
-
22
- Target Page panelinde component'leri sürükleyerek sıralayabilirsiniz:
23
- - Component'i tutun ve istediğiniz pozisyona sürükleyin
24
- - Component otomatik olarak yeni pozisyonuna taşınacaktır
25
-
26
- ### 5. Değişiklikleri Kaydetme
27
-
28
- 1. Yaptığınız değişiklikler otomatik olarak draft olarak kaydedilir
29
- 2. Değişiklikleri yayınlamak için **Publish** butonuna tıklayın
30
- 3. Başarılı olduğunda bir onay mesajı görüntülenecektir
31
-
32
- ## Özellikler
33
-
34
- ### Aynı Sayfada Kopyalama
35
-
36
- Aynı sayfayı hem source hem de target olarak seçebilirsiniz:
37
- - Bu durumda component'ler duplicate (çoğaltılır) olur
38
- - Aynı sayfa içinde component'leri çoğaltabilirsiniz
39
-
40
- ### Detaylı Bilgi Görüntüleme
41
-
42
- Component kopyalandıktan sonra:
43
- - Başarı mesajına tıklayarak detaylı bilgi modal'ını açabilirsiniz
44
- - Hangi alanların kopyalandığını görebilirsiniz
45
- - Hangi alanların kopyalanamadığını (örn: sistem alanları) görebilirsiniz
46
- - Media dosyalarının kopyalanma durumunu görebilirsiniz
47
-
48
- ### Component Önizleme
49
-
50
- Her component için:
51
- - Component tipi (badge olarak gösterilir)
52
- - Component içeriğinin önizlemesi (title, description vb.)
53
- - Drag handle (sürükleme için)
54
-
55
- ## Kullanım Senaryoları
56
-
57
- ### Senaryo 1: Yeni Sayfaya Component Kopyalama
58
-
59
- 1. Source Page: "Ana Sayfa"
60
- 2. Target Page: "Hakkımızda"
61
- 3. Ana Sayfa'dan Hero Section'ı sürükle
62
- 4. Hakkımızda sayfasına bırak
63
- 5. Publish et
64
-
65
- ### Senaryo 2: Aynı Sayfada Component Çoğaltma
66
-
67
- 1. Source Page: "İletişim"
68
- 2. Target Page: "İletişim" (aynı sayfa)
69
- 3. Form Section'ı sürükle
70
- 4. Aynı sayfanın sonuna bırak
71
- 5. Publish et
72
-
73
- ### Senaryo 3: Component Sıralama
74
-
75
- 1. Target Page'i seç
76
- 2. Component'leri istediğiniz sıraya göre sürükle
77
- 3. Değişiklikler otomatik kaydedilir
78
- 4. Publish et
79
-
80
- ## İpuçları
81
-
82
- 1. **Çoklu Kopyalama**: Şu anda bir seferde bir component kopyalanabilir. Birden fazla component için işlemi tekrarlayın.
83
-
84
- 2. **Undo**: Şu anda geri alma özelliği yok. Değişikliklerden önce yedek alın.
85
-
86
- 3. **Publish**: Draft olarak kaydedilen değişiklikler yayınlanana kadar frontend'de görünmez.
87
-
88
- 4. **Media Dosyaları**: Media dosyaları referans olarak kopyalanır, yeni dosya oluşturulmaz.
89
-
90
- 5. **Relations**: Single type relation'lar (örneğin siteSettings) kopyalanır ancak target sayfada mevcut relation kullanılır.
91
-
92
- ## Kısıtlamalar
93
-
94
- 1. **System Fields**: `id`, `documentId`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`, `publishedAt`, `locale` gibi sistem alanları otomatik olarak kaldırılır.
95
-
96
- 2. **Complex Relations**: Çok karmaşık relation'lar kopyalanmayabilir. Test edin.
97
-
98
- 3. **Validation**: Component schema'larındaki validation kurallarına uygun veriler gerekir.
99
-
100
- 4. **Permissions**: Gerekli izinlere sahip olmanız gerekir.
101
-
102
- ## Sorun Giderme
103
-
104
- ### Component kopyalanmıyor
105
-
106
- - İzinleri kontrol edin
107
- - Browser console'da hata var mı bakın
108
- - Network tab'inde API isteği başarılı mı kontrol edin
109
-
110
- ### Modal açılmıyor
111
-
112
- - Tarayıcı cache'ini temizleyin
113
- - Sayfayı yenileyin (F5)
114
- - Strapi'yi yeniden başlatın
115
-
116
- ### Component'ler görünmüyor
117
-
118
- - Sayfaların yayınlandığından emin olun
119
- - Dynamic zone'ın doğru yapılandırıldığını kontrol edin
120
- - Component'lerin populate edildiğinden emin olun
121
-
@@ -1,22 +0,0 @@
1
- import type { Core } from "@strapi/strapi";
2
-
3
- const controller = ({ strapi }: { strapi: Core.Strapi }) => ({
4
- async hello(ctx) {
5
- ctx.body = {
6
- message: "Hello from my plugin! 👋",
7
- timestamp: new Date().toISOString(),
8
- plugin: "copy-any-component",
9
- };
10
- },
11
-
12
- async greet(ctx) {
13
- const { name } = ctx.params;
14
- ctx.body = {
15
- message: `Merhaba, ${name}! 🎉`,
16
- timestamp: new Date().toISOString(),
17
- };
18
- },
19
- });
20
-
21
- export default controller;
22
-
@@ -1,5 +0,0 @@
1
- import controller from "./controller";
2
-
3
- export default {
4
- controller,
5
- };
@@ -1,13 +0,0 @@
1
- import controllers from "./controllers";
2
- import routes from "./routes";
3
-
4
- export default {
5
- register({ strapi }) {
6
- // Register plugin
7
- },
8
- bootstrap({ strapi }) {
9
- strapi.log.info("🚀 My Simple Plugin loaded successfully!");
10
- },
11
- controllers,
12
- routes,
13
- };
@@ -1,11 +0,0 @@
1
- export default [
2
- {
3
- method: "GET",
4
- path: "/hello",
5
- handler: "controller.hello",
6
- config: {
7
- policies: [],
8
- },
9
- },
10
- ];
11
-
@@ -1,19 +0,0 @@
1
- export default [
2
- {
3
- method: "GET",
4
- path: "/hello",
5
- handler: "controller.hello",
6
- config: {
7
- policies: [],
8
- },
9
- },
10
- {
11
- method: "GET",
12
- path: "/greet/:name",
13
- handler: "controller.greet",
14
- config: {
15
- policies: [],
16
- },
17
- },
18
- ];
19
-
@@ -1,13 +0,0 @@
1
- import contentApi from "./content-api";
2
- import admin from "./admin";
3
-
4
- export default {
5
- "content-api": {
6
- type: "content-api",
7
- routes: [...contentApi],
8
- },
9
- admin: {
10
- type: "admin",
11
- routes: [...admin],
12
- },
13
- };